I am having problems outputting the data I require:
$start_of_month = mktime(00, 00, 00, date('m'), 01);
$datestart = date("Y-m-d H:i:s",$start_of_month);
'SELECT
orderheader.ordernumber
, ccilog.sessionid
, ccilog.orderid
, orderheader.userid
, users.emailaddress
, orderheader.webbrandcode
, orderitems.productcode
, orderitems.productname
, orderheader.datecreated
, ccilog.formattedpaymentdate
, orderheader.voucherpromotioncode
, orderheader.vouchercode
, orderheader.itemtotalsell
, orderheader.shippingtotalsell
, orderheader.totalbeforediscount
, orderheader.voucherdiscountvalue
, orderheader.totaldiscount
, orderheader.totalsell
, orderheader.totaltax
, orderheader.total
, orderitems.subtotal
, orderitems.discountvalue
, ccilog.amount
FROM orderheader
LEFT JOIN ccilog ON orderheader.id=ccilog.orderid
LEFT JOIN orderitems ON ccilog.orderid=orderitems.orderid
LEFT JOIN users ON orderheader.userid=users.id
WHERE ccilog.formattedpaymentdate "'.$datestart.'"'
I have a script that turns this query into a csv file. The whole script works great until I put in the where statement, an I don’t get whaty I expect.
I have three rows that contain the dates greater than the start of the month date $datestart, but for some reason only 2 of them show and I just cant work out why?
My dates are setup in the same format is $datestart (eg 2011-07-07 13:31:28) and the 3 rows have the same dates but slightly different times, about 4 mins apart.
I’m stuck, can someone give me a bit of advice?
Thanks