Warning: mysql_fetch_assoc() expects parameter 1 to be resource, boolean given in \xampp\htdocs\proj\demo.php on line 57

Can anyone explain my problem. Thanks!

<?php

$result = mysql_query("SELECT * FROM internet_shop");
while($row=mysql_fetch_assoc($result))
{
    echo '<div class="product"><img src="img/products/'.$row['img'].'" alt="'.htmlspecialchars($row['name']).'" width="128" height="128" class="pngfix" /></div>';
}

?>

The error suggests that mysql_query() returned FALSE as mentioned is one possible return value here. You need to extract more information to properly diagnose the failure:

$query = ''SELECT * FROM internet_shop';
$result = mysql_query($query);

if (!$result) {
    die("'$query' failed with error: " . mysql_error());
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.