开发者

Dropping a column from a "$result" resource after a db query

开发者 https://www.devze.com 2022-12-17 20:16 出处:网络
After a simple query that is successful, $sql = \"SELECT * FROM mytable\" ; $resu开发者_运维技巧lt = mysql_query ( $sql ) ;

After a simple query that is successful,

$sql = "SELECT * FROM mytable" ;
$resu开发者_运维技巧lt = mysql_query ( $sql ) ;

is there a way to "drop" a specified column from the $result resource? IOW, the $result consisted previously of 8 fields, but afterwards contains of only 7.

Thanks.


What you could do is assign the values from your $result into an array, unset $result to clear up the memory (if it is a large result set), and then unset the specific sub array containing the column data no longer needed.


I think you can't do that after you have commited the query with specified columns. However you can specify this from your query statement as to which columns should be selected.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号