Re: Listing all id's in array
| From: | Daniel Clark | Date: | Wed, 28 Apr 2004 21:16:45 +0000 |
| Subject: | Re: Listing all id's in array | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-184904@lists.php.net to get a copy of this message | ||
I think you want the output within the loop.
$query = "SELECT product_id FROM products";
$result = mysql_query($query) or die("error in query - $query -
".mysql_error());
while (list($product_id) = mysql_fetch_array($result)) {
echo "$product_id" . "<BR>";
}
> I want to list all the product id's af the database in an array, but i do
> not how.
>
> I have this script but it is not working:
>
> $model = array();
>
> $query = "SELECT product_id FROM products";
> $result = mysql_query($query) or die("error in query - $query -
> ".mysql_error());
> while (list($product_id) = mysql_fetch_array($result)) {
> $model = "$product_id";
> }
>
> echo "$model";
>
>
> Plese someone tell me how to do it...
>
> Thanks
>
>