You missed making $array an array:
Originally posted by Jamez
while ($row = mysql_fetch_assoc($result))
{
$array = $row['name'];
}
[/b]
while ($row = mysql_fetch_assoc($result))
{
$array[] = $row['name'];
}
If you want all those variables in there, why take them out of the $row array?
while ($row = mysql_fetch_assoc($result))
{
$array[] = $row;
}
And of course, if you only want those fields, then you should only ask for those fields in the first place:
$sql = "SELECT name,price,desc FROM prods WHERE cat = '$category' AND subcat = '$subcategory'";