Page 1 of 1
date intervals
Posted: Fri Oct 15, 2004 3:42 am
by irealms
i'm having problems getting this to work
SELECT * FROM orders WHERE DATE_SUB(CURDATE(),INTERVAL 7 DAY) <= dateadded AND status!='Quote'
keep getting errors and despite trying the manual i can't seem to get it working. Any ideas?
Posted: Fri Oct 15, 2004 3:43 am
by twigletmac
What's the error?
Mac
Posted: Fri Oct 15, 2004 3:48 am
by irealms
unexpected TL_NUMBER, T_VARIABLE or $
Posted: Fri Oct 15, 2004 4:31 am
by irealms
erm i had a varible $7orders, it didn't like the 7

Posted: Fri Oct 15, 2004 4:36 am
by irealms
the query now seems to not be drawing from 7 days, i have 5 orders in database from october, 4 from 14th and one from 4th and it's counting 5 as in the last 7 days, though the one from the 4th shouldn't be counted.
Posted: Fri Oct 15, 2004 5:13 am
by mudkicker
can you post your code please?
Posted: Fri Oct 15, 2004 5:25 am
by irealms
$weekorders = "SELECT * FROM orders WHERE DATE_SUB(CURDATE(),INTERVAL 7 DAY) <= dateadded AND status!='Quote'";
$weekordersq = mysql_query($weekorders, $db_conn) or die("Query $weekordersq Failed".mysql_error());
Posted: Fri Oct 15, 2004 5:38 am
by irealms
hmm don't know what i did but it's working now i think
