Start New Discussion within our Web Development Community

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!


$result = mysql_query("SELECT * FROM internet_shop");
    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());
This article has been dead for over six months. Start a new discussion instead.