BETWEEN query not working
Posted: Wed Aug 08, 2007 5:03 am
Having problems getting one part of a query working on a site. It's just the last part of the query where I am searching for records that are set between a certain year.
So the above searches that the year that was selected is between the "madefrom" year and the "madeto" year (well it should but it isn't working, can anyone help please?! 
I have also tried changing the last bit to this but still had no luck gettign it to work
Cheers
Wardy
Code: Select all
$query = "SELECT * FROM *MYTABLE* WHERE make='$make' AND model LIKE '%$model%' AND WHERE $year between madefrom AND madeto LIMIT $limitvalue, $limit";I have also tried changing the last bit to this but still had no luck gettign it to work
Code: Select all
WHERE $year between datepart(yy,madefrom) AND datepart(yy,madeto)Wardy