dimanche 28 juin 2015

mysqli sum gets me a error so mabe someone can?

hi i have the following:

wntl_virtuemart_order_items 

product_quantity
order_item_name
order_item_sku

I connect with the DB run this php below

$count="SELECT wntl_virtuemart_order_items, product_quantity sum(product_quantity ) as total 
        from wntl_virtuemart_order_items 
        group by order_item_name";
echo "<table>";

echo "<tr><th>order_item_sku</th><th>order_item_name</th><th>product_quantity</th></tr>";

foreach ($dbo->query($count) as $row) {

echo "<tr ><td>$row[order_item_sku]</td>
           <td>$row[order_item_name]</td>
           <td>$row[product_quantity]</td>
           <td>$row[total]</td></tr>";    
}

echo "</table>";

$conn->close();
?>

and i get the error:

Call to a member function query() on a non-object in 23

What am i doing wrong?

My plan was to know how much products where ordered per item.

Aucun commentaire:

Enregistrer un commentaire