Hey guys - I've started coding a simple PHP mini shopping cart script, and I'm getting this error:
Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\cart.php on line 8
My Code is the following
session_start();
$page = 'index.php';
require('config.php');
function products(){
$get = mysql_query('SELECT id, name, description, price FROM products WHERE quantity > 0 ORDER BY id DESC');
$get1 = mysql_num_rows($get);
if ($get1==0){
echo "There are no products for sale at this moment, please check back later.";
} else {
echo "Success!"; //echo products
}
}
mysql_close();
Any idea why i'm getting this error? How can I fix it?
Thanks.