Hello!
I need to select things from a mySQL database where the timestamp column is last month.
So far i am using this;
$TimeStampA = Date("Ymd000000");
$TimeStampB = Date("Ymd000000", time()-Date("t")*24*3600);
$Month = mysql_query("SELECT `ID` FROM `tblTest` WHERE `Submit_Time` BETWEEN '$TimeStampA' AND '$TimeStampB'", $dbhndl);
The problem i have with this is that it treats the current day as the start of the month, which i dont want. (Also, it uses the number of days from this month as last mont, but i have only just realised!)
I also have to select everything from this week, but have the same problem.
I think i need to use 'mktime' but i dont really know.
If anyone could help i would really appreciate it!
Thanks.