|
Posted by Marcin Dobrucki on 02/13/06 14:54
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]);
>
> }
Not directly, but if you are using PEAR:DB, you could use
DB::getCol() for this:
http://pear.php.net/manual/en/package.database.db.db-common.getcol.php
/Marcin
Navigation:
[Reply to this message]
|