|
Posted by Jerry Stuckle on 02/12/06 03:18
veg_all@yahoo.com wrote:
> Is there a way to select a single column from a mysql database and
> directly put the results into an arrray? Here is the workaround below,
> but I would like to elimniate the array_push step:
>
> $uids=array();
> $res = mysql_db_query("db", 'select uid from tbl;', $link);
> while ($row = mysql_fetch_row($res)) {
> array_push ($uids, $row[0]);
>
> }
>
Sorry, no.
You can do similar things, but you always end up calling
mysql_fetch_rows() or mysql_fetch_array().
mysql_query (not mysql_db_query as you have) returns a result object or
false, not an array. You must retrieve your data from the result
object, whether you have one column (or row) or hundreds.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
Navigation:
[Reply to this message]
|