Hi guys
I have a problem, im calling a array into a dropdown. Its showing the correct number of rows but they all display 'array' and not the values from the database
Can anyone help me?
PHP Code:$sql = "SELECT category FROM category";
$result = mysql_query($sql) or die("SQL error: ".mysql_error());
if(mysql_num_rows($result) != 0)
{
while($tmp = mysql_fetch_assoc($result))
{
$allcategory[] = array($tmp);
}
}
PHP Code:
<? echo "<select name='category'>";
foreach($allcategory as $z) {
$selected = ($z == $category) ? 'selected="selected"' : '';
echo "<option value='$z' $selected>$z</option>\n";
}
?>






Bookmarks