
October 5th, 2004, 11:42 AM
|
|
Registered User
|
|
Join Date: Apr 2004
Posts: 29
Time spent in forums: 3 m 17 sec
Reputation Power: 0
|
|
Whats wrong with this snippet
Good Day Yall!
I am looking for a insightful eye to look at the following snippet and tell me what I am doing wrong! I am using PHP 4.3 and MySQL and the following snippet is supposed to allow the user to enter two dates and run a query which will return all the records with dates equal to or between the two dates entered. Unfortunately, all it does is return the record set for only the two dates specifically entered. For example if I enter 10/01/04 and 10/15/04 it returns all the records for only those two days and none of the days in between. I want it to return the record set for the dates entered and all the dates between. Records with dates of 10/01/04 through 10/15/04. I have tried <= and >= but that doesn't work. I know the answer is probably incredibly simple but I am rather dumb and stuck to boot! Any help or suggestions appreciated. Here is the query I am using
$result = mysql_query( "SELECT * FROM ttime where ((SNUM = '".$_SESSION['SNUM']."') and ".$TIDATE." like '%".$TIDATEA."%') or ((SNUM = '".$_SESSION['SNUM']."') and ".$TIDATE." like '%".$TIDATEB."%') ORDER BY TIDATE ASC")
or die("SELECT Error: ".mysql_error());
Thanks
Have a Great Day!
|