mysql_fetch_assoc() expects parameter 1 to be resource, boolean given in
- by user2533440
I cannot figure out whats wrong with this code. Every time i try to run this file I get error mysql_fetch_assoc() expects parameter 1 to be resource
<?php
$q = "select * from tbfood";
$rs = mysql_query($q);
while($msg = mysql_fetch_assoc($rs)){
echo "<p>".$msg["name"]."</p>";
echo "<p>".$msg["price"]."</p>";
if ($msg['idDruh'] == 1) {
echo "string1";
} elseif ($msg['idDruh'] == 2) {
echo "string2";
} elseif ($msg['idDruh'] == 3) {
echo "string3";
} elseif ($msg['idDruh'] == 4) {
echo "string4";
} elseif ($msg['idDruh'] == 5) {
echo "string5";
} elseif ($msg['idDruh'] == 6) {
echo "string6";
} elseif ($msg['idDruh'] == 7) {
echo "string7";
}
}
?>