I have a database with stuff about purchases from my site. I have the date and time sold stored in the following format
2012-04-23 16:29:28
Now what I have this currently for getting products that a certain person has purchased:
$result = mysql_query("SELECT * FROM `purchases` WHERE `ReceiverKey` LIKE '4da0e081-320d-4c7b-bf5b-3d9f022d21d3' AND `InventoryName` LIKE '[Dugley] Cache Clearer 2.0' LIMIT 0, 30 ") or die(mysql_error());
However I need to sort the When column to only show purchases within the last 30 days.
Any ideas on how to do this efficiently? Code examples would be appreciated as I suck at dates.
Thanks.
1 Answer