How All
How would I go about sorting results by the the date selected from a calendar?
I am assuming I need to do something like SELECT from here WHERE date = $date
but how do I get the date to store in the variable? Now that I think about it I guess the date would post to the page itself and store the variable.
Any help?
Sort based on date selected??
Moderator: General Moderators
Re: Sort based on date selected??
Sorting in SQL is done with the ORDER BY clause - http://dev.mysql.com/doc/refman/5.0/en/ ... -rows.html
Couldn't really understand the rest of your question..
Couldn't really understand the rest of your question..
Re: Sort based on date selected??
Sorry if I was unclear.
I am looking for the user to be able to select a date and only show results from the date selected.
I am looking for the user to be able to select a date and only show results from the date selected.
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
Re: Sort based on date selected??
Re: Sort based on date selected??
you were right in your assumption.
Code: Select all
$query = "SELECT * FROM `someTable` WHERE `someDateField` = '".date("Y-m-d",strtotime($_POST['date']))."'";