faqts : Computers : Programming : Languages : PHP : Database Backed Sites : MySQL

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

6 of 16 people (38%) answered Yes
Recently 3 of 10 people (30%) answered Yes

Entry

Can I get the results of a mysql query listed for a specific column, as an array or comma-delineated list instead of looping over the rows?

Jan 15th, 2001 06:57
Noah Blumenthal, Caroline Wise, Ben Udall, http://www.php.net/manual/en/function.mysql-fetch-array.php


If you don't already, you may want to use a function 
"mysql_fetch_array" instead of "mysql_fetch_row".  The function is used 
like so: "$result = mysql_fetch_array($query);", or you can do a while 
loop surrounding that.  What this does is allow you to refer to a 
column by it's name, ie: $result[firstname] or $result
[credit_card_number].
I hope this was helpful.