Re: Query table / results to an array

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Ron Piggott wrote:
I need help populating an array based on the output of a mysql query.


$reference_number is a value assigned by auto_increment
$description is what I want the value of the array to be --- a few words
in length

$reference_number = mysql_result($search_result,$i,"reference_number");
$description = mysql_result($search_result,$i,"description");


$references = array();

$result = "select id, description from table";
while ($row = mysql_fetch_assoc($result)) {
$references[$row['id']] = htmlentities($row['description'], ENT_QUOTES, 'ISO-8859-1');
}

print_r($references);


--
Postgresql & php tutorials
http://www.designmagick.com/

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


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux