I have two tables:
What I want to do is run a query which looks at order_inv for the productId and quantity then joins that with the time from ord_sum
With the end result being when looking at the list of my products, it shows how many have been ordered this month.
The code Im currently using:
$date_array = getdate(); extract($date_array); $start_of_month = mktime(0, 0, 0, $mon, 1, $year); $db = new db(); $query = "select sum(quantity) as total_quantity from ".$glob['dbprefix']."CubeCart_order_inv INNER JOIN ".$glob['dbprefix']."CubeCart_order_sum where time>=$start_of_month and productId = ".$db->mySQLsafe($_GET['productId']); $total_this_month = $db->select($query); echo $total_this_month; echo "test";
Which appears to work ok as it doesnt result in an error and echoes back "Array" and "test"
What I need it do is actually echo back for each product that is listed.
Any help that can be given would be highly appreciated.