I get this message quite often and it has popped up again here, any ideas as to why?
Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\.... on line 76
line 76 is this line in bold.
$productlist = "";
$sql = mysql_query("SELECT * FROM products ORDER BY dateadded DESC");
[B]$productCount = mysql_num_rows($sql); // count the output amount[/B]
if ($productCount > 0) {
while($row = mysql_fetch_array($sql)){
$id = $row["id"];
$productname = $row["productname"];
$price = $row["price"];
$dateadded = strftime("%b %d, %Y", strtotime($row["dateadded"]));
$productlist .= "Product ID: $id - <strong>$productname</strong> - $price - <em>Added $dateadded</em> <a href='inventoryedit.php?pid=$id'>edit</a> • <a href='inventorylist.php?deleteid=$id'>delete</a><br />";
}
} else {
$productlist = "You have no products listed in your store yet";
}
If anyone has the answer for this that will be great.