Re: Building associative arrays
| From: | rush | Date: | Fri, 03 Oct 2003 12:01:40 +0000 |
| Subject: | Re: Building associative arrays | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-164894@lists.php.net to get a copy of this message | ||
> 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.
is this what you are lookin for?
mysql_fetch_row etc....
{ //let's assume $row is result of mysql_fetch:row(..
$key = $row['key_sql_col'];
$value = $row['value_sql_col'];
$myarray[$key]=$value;
}
rush
--
http://www.templatetamer.com/
"Chris Neale" <chris.neale@somerfield.co.uk> wrote in message
news:09FC00221135D711AD0A00508BB84CBD31045C@NTABEXG5...