Hi,
I have a PHP search feature in which the user specifies a date span which results in selecting all the data entries between the two dates. For this, I am using timestamps. My SQL query looks like this:
Code: Select all
$sql = "SELECT * FROM downtime WHERE dwntime_ts1 > '$ts1' < dwntime_ts2 ORDER BY dwntime_ts1";
where dwntime_ts1 is the "start date" of the entry in timestamp form, dwntime_ts2 is the "end date" of the entry in timestamp form, and $ts1 is the user-defined timestamp required in the search. However, no matter what dates I enter, it just keeps selecting the entire table's information instead of the specific rows. I have a feeling that I am going about this the wrong way... not too sure, so any help is appreciated!
Thanks!
- Jeff