PyraX Posted July 21, 2007 Share Posted July 21, 2007 Hi, Im trying to make an order reporting page that gets all the orders from any month and any year. It will look something like this: $sql = "SELECT * FROM orders WHERE ..." Thanks in advance Link to comment https://forums.phpfreaks.com/topic/61057-solved-mysql-selecting-specified-month-and-year-using-php/ Share on other sites More sharing options...
cooldude832 Posted July 21, 2007 Share Posted July 21, 2007 if your date is in a unix time stamp use the mktime functions to get you a string formatted the right way and then say WHERE Date > $start && Date < $end where $start = beginning of the year in unix seconds (or month) and $end = end of year in unix seconds Link to comment https://forums.phpfreaks.com/topic/61057-solved-mysql-selecting-specified-month-and-year-using-php/#findComment-303858 Share on other sites More sharing options...
PyraX Posted July 21, 2007 Author Share Posted July 21, 2007 I need to have the url so that its like admin.php?do=order_view&month=06&year=2007 Thanks cooldude Link to comment https://forums.phpfreaks.com/topic/61057-solved-mysql-selecting-specified-month-and-year-using-php/#findComment-303860 Share on other sites More sharing options...
cooldude832 Posted July 21, 2007 Share Posted July 21, 2007 thats fine, do you understand the date() functions in php if not look em up on php.net or w3schools.org has a very nice reference table of the flags for date returns all you have to do is say mktime() using $_GET['month'] as the month and $_GET['year'] as the year Link to comment https://forums.phpfreaks.com/topic/61057-solved-mysql-selecting-specified-month-and-year-using-php/#findComment-303862 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.