Re: Building associative arrays
| From: | Eugene Lee | Date: | Fri, 03 Oct 2003 12:06:47 +0000 |
| Subject: | Re: Building associative arrays | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-164895@lists.php.net to get a copy of this message | ||
On Fri, Oct 03, 2003 at 10:22:55AM +0100, chris.neale@somerfield.co.uk wrote:
:
: I'm trying to build an associative array from a database result. How can I
: assign a new key and value pair
:
: eg
:
: mysql_fetch_row etc....
: {
: dbRowCol1 = myarray(key)
: dbRowCol2 = myarray(value)
: }
:
: You get the general idea. Can't find any examples. I'm trying to lookup a
: key and retrieve the corresponding value.
If you really want your table's field names returned as keys, try using
mysql_fetch_assoc().
http://www.php.net/manual/en/function.mysql-fetch-row.php