Have you tried breaking your where clause ('$from_date_tt' <=
timestamp <= '$to_date_tt') into two statements like timestamp >=
$from_date_tt and timestamp <= $to_date_tt?--- In [email protected], "Mahmoud M. Abdel-Fatah" <[EMAIL PROTECTED]> wrote: > > Hello, > > I'm making a simple inventory management system; I want the user to > add date in data entry process, then he can make reports between > specified 2 dates !! > > > I have a column in MySQL DB called "timestamp" & i'm inserting the > date into it in the format : > strtotime("yyyy/mm/dd"); > > > in the report page , I make MySQL select statement : > ================================ > SELECT * FROM history WHERE type LIKE '$type' AND category LIKE > '$category' AND name LIKE '$name' AND toward LIKE '$freezer' AND > ('$from_date_tt' <= timestamp <= '$to_date_tt') LIMIT $offset, > $rowsPerPage ; > ================================ > where : > $from_date_tt=strtotime("yyyy/mm/dd"); > $to_date_tt=strtotime("yyyy/mm/dd"); > and ofcourse it's different times. > > > and my problem that it show all entries !! even that it's not between > these 2 dates !! > > > is there a better way to use to store dates in MySQL and compare > between them?? > > > Best Regards, > Mahmoud M. Abdel-Fattah >
