Page 1 of 1

Sort based on date selected??

Posted: Mon Jan 19, 2009 10:02 am
by cupaball
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?

Re: Sort based on date selected??

Posted: Mon Jan 19, 2009 10:36 am
by Eran
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.. :|

Re: Sort based on date selected??

Posted: Mon Jan 19, 2009 6:31 pm
by cupaball
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.

Re: Sort based on date selected??

Posted: Mon Jan 19, 2009 6:44 pm
by Chris Corbyn
:arrow: Move to PHP Code

Re: Sort based on date selected??

Posted: Wed Jan 21, 2009 12:30 pm
by cupaball
Anyone?

Re: Sort based on date selected??

Posted: Wed Jan 21, 2009 12:36 pm
by Burrito
you were right in your assumption.

Code: Select all

 
$query = "SELECT * FROM `someTable` WHERE `someDateField` = '".date("Y-m-d",strtotime($_POST['date']))."'";