In message <[EMAIL PROTECTED]>, Mahmoud M. Abdel-Fatah
<[EMAIL PROTECTED]> writes
>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.

I didn't think the 
('$from_date_tt' <= timestamp <= '$to_date_tt')
worked in MySQL, I would use
('$from_date_tt' <= timestamp ) AND ( timestamp <= '$to_date_tt')

Using your method, all records were returned where $to_date_tt has a
value.  If $to_date_tt is empty, then the records weren't returned.  I
have no idea why... 

-- 
Pete Clark

Sunny Andalucia
http://www.hotcosta.com/comm_1.htm

Reply via email to