Re: Results in array

From: Date: Sun, 02 May 2004 16:10:09 +0000
Subject: Re: Results in array
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-185142@lists.php.net to get a copy of this message
Phpu wrote:
I want to interogate the database and the results to be placed into array. For now i have: $query = "SELECT product_id, brand_name, model_name FROM products WHERE product_id='$product_id'"; $result = mysql_query($query) or die("error in query - $query - ".mysql_error()); $results = mysql_num_rows($result); I want all athe results to be placed in an array named "models" and then i want to print all the results. How can i do that. PS. The results must be placed in an array.
while($row = mysql_fetch_assoc($results)) { $models[] = $row; } echo "<pre>"; print_r($models); echo "</pre>";

« previous php.general (#185142) next »