Hi i tried the few things you suggested and still no luck: changing the $result variables as shown below still came up with 0 when processed:
function getOrderAmount($orderId)
{
$orderAmount = 0;
$sql = "SELECT SUM(pd_price * od_qty)
FROM tbl_order_item oi, tbl_product p
WHERE oi.pd_id = p.pd_id and oi.od_id = $orderId";
$result1 = dbQuery($sql);
$sql2 = "SELECT od_shipping_cost
FROM tbl_order
WHERE od_id = $orderId";
$result2 = dbQuery($sql2);
if (dbNumRows($result1) == 2) {
$row = dbFetchRow($result1);
$totalPurchase = $row[0];
$row2 = dbFetchRow($result2);
$shippingCost = $row2[0];
$orderAmount = $totalPurchase + $shippingCost;
}
return $orderAmount;
}
?>
PS all dbQuery() returns is
function dbQuery($sql)
{
$result = mysql_query($sql) or die(mysql_error());
return $result;
}
I also tried the query and no luck 'Mixing of GROUP columns (MIN(),MAX(),COUNT(),...) with no GROUP columns is illegal'
Anything im doing wrong with the code? I am so lost and tired with this one and only because I cant use UNION with an order SQL version 😕