Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\dl\cart\includes\functions.php on line 37
There was an error with your order!
function get_order_total(){
$cnt = array();
$products = array();
foreach($_POST as $key=>$value)
{
$key=(int)str_replace('_cnt','',$key);
$products[]=$key;
$cnt[$key]=$value;
}
$result = mysql_query("SELECT * FROM shop WHERE id IN(".join($products,',').")");
if(!mysql_num_rows($result))
{
echo '<h1>There was an error with your order!</h1>';
}
else
{
echo '<h1>You ordered:</h1>';
while($row=mysql_fetch_assoc($result))
{
echo '<h2>'.$cnt[$row['id']].' x '.$row['name'].'</h2>';
$total+=$cnt[$row['id']]*$row['price'];
}
echo '<h1>Total: $'.$total.'</h1>';
}