Forum Moderators: open
$query = ("SELECT * FROM $table WHERE first_name LIKE '$first_name%' AND
last_name LIKE '$last_name%' AND street1 LIKE '%$street1%' AND city LIKE
'$city%' AND zipcode LIKE '$zipcode%' AND state LIKE
'$state%' AND gender LIKE '$gender%' AND optin_status LIKE '$optin_status%' AND subscriber LIKE '$subscriber%' AND dob BETWEEN '%$dob1' AND '%$dob2' LIMIT 0, $limit ");
both dob1 and dob2 are four digit numbers.. and they do pass to this result page correctly and they do exist in the db.. i can pull results for one if I specify just one like "AND dob LIKE '%$dob1'".. I think it has to do with the AND between the start and end numbers.. I'll bet I need to seperate that part of the request from the rest of it somehow but am struggling with the correct syntax.. I'll bet somebody knows this without even thinking bout it. php/MySql
[edited by: The_Hat at 3:43 pm (utc) on July 24, 2008]
Edit reason.. the three x's in the original got censored.
[edited by: The_Hat at 5:01 pm (utc) on July 24, 2008]
they are numbers but the way they are inside of the database is x/xx/#*$!x
I suggest converting the field to a DATE field. Otherwise, use SUBSTRING (or whatever the similar function is in MySQL) to just comparing the year part of the field.
But in general, storing dates as character strings will almost always come back and bite you in the backside down the road (like now :) ). DBs have so many fuctions for converting and comparing dates- it's almost always better to let the DB do the work for you.
[edited by: LifeinAsia at 5:07 pm (utc) on July 24, 2008]
Thanks again.