Find records between 2 dates (mysql query)

can some1 plz tell what line of code do I need to put in the WHERE clause to find all records between 2 dates plz?


$message = mysql_query("SELECT * FROM wwwpages WHERE Language='$lang_choice'") or die(mysql_error());

Do you know the dates to look between already or do you need to calulate a date.

For alreading knowing them assuming you are using datetime fields.


$message = mysql_query("SELECT * FROM wwwpages
WHERE (datefield BETWEEN '$startdate' AND '$enddate') AND Language='$lang_choice'") or die(mysql_error());

If you needed to say grab all between now and two weeks ago.


$message = mysql_query("SELECT * FROM wwwpages
WHERE (datefield BETWEEN DATE_SUB(NOW(), interval 2 week) AND NOW()) AND Language='$lang_choice'") or die(mysql_error());

thank you !!!

it was the first example i needed. Just couldnt rememember it at all!! :slight_smile:

ta