PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
I have a table with a datetime field.
Now i want to select rows between two specific dates.
Lets say from 27-11-08 to 16-01-09. I want the result to display all the entries within that period including the records that are entered on 16-01-09. I could not get a proper mysql query to do that. Can someone help me out with this one?
that was helpful but there is another problem. I am unable to get the rows which were inserted ON '$to_date'
The problem is if i give the dates as 2009-01-14 to 2009-01-16, i want it to display all the rows even on 2009-01-16. The solution might be to add a day to the $to_date variable but how to do it?
susrisha wrote:that was helpful but there is another problem. I am unable to get the rows which were inserted ON '$to_date'
BETWEEN...AND includes the "from" and "to" dates.
Is the "Time" field a DATETIME? When you give a date without a time MySQL pretends you said it was at midnight. So 2008-01-15 actually means 2008-01-15 00:00:00.
If you think about it you'll see what happens.