RE: [PHP] associative arrays

From: Date: Thu, 12 Jul 2001 13:46:00 +0000
Subject: RE: [PHP] associative arrays
Groups: php.general 
Request: Send a blank email to php-general+get-57588@lists.php.net to get a copy of this message
$result = mysql_db_query("database","select item1, item2 from table"); while ($row = mysql_fetch_array($result)) { $myArray[$row['item1']] = $row['item2']; } > -----Original Message----- > From: Martin Lucas [mailto:martin.lucas@techconsult.de] > Sent: 12 iulie 2001 16:25 > To: 'php-general@lists.php.net' > Subject: [PHP] associative arrays > > > Hi everybody > i have the following database query: > > $result=mysql_db_query("database","select item1,item2 from table"); > while ($row=mysql_fetch_array($result)){ > $a=$row[item1]; > $b=$row[item2]; > > } > what i need is an associative array, with $a as key and $b as value, > containing each item1 and item2 from the database > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: > php-list-admin@lists.php.net > >

« previous php.general (#57588) next »