Perfect. Thanks for that. I can't think associative arrays first thing in
the morning. Seems a bit clearer now...

C

-----Original Message-----
From: Eugene Lee [mailto:[EMAIL PROTECTED]
Sent: 03 October 2003 12:07
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Building associative arrays


On Fri, Oct 03, 2003 at 10:22:55AM +0100, [EMAIL PROTECTED]
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

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
 
If you are not the intended recipient of this e-mail, please preserve the
confidentiality of it and advise the sender immediately of any error in
transmission. Any disclosure, copying, distribution or action taken, or
omitted to be taken, by an unauthorised recipient in reliance upon the
contents of this e-mail is prohibited. Somerfield cannot accept liability
for any damage which you may sustain as a result of software viruses so
please carry out your own virus checks before opening an attachment. In
replying to this e-mail you are granting the right for that reply to be
forwarded to any other individual within the business and also to be read by
others. Any views expressed by an individual within this message do not
necessarily reflect the views of Somerfield.  Somerfield reserves the right
to intercept, monitor and record communications for lawful business
purposes.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to