$GetListNews = "SELECT * FROM news WHERE title LIKE '%$searchQuery%' OR copy LIKE '%$searchQuery%' OR teaser LIKE '%$searchQuery%' AND year = '$date' ORDER BY id desc";
Hi, please can someone tell me why the above code does not work.
Basically I submit a key word, and this script is supposed to pull out the rows of data that has the keyword within 3 of the fields (title, copy and teaser).
This works. But I want to narrow it down further. Each entry has a filed "year" in which it says 2003, 2004, 2005 etc etc etc
For some reason when this search is submitted is pull out all the rows of data with the correct keywords but it completly ignores the last bit of the query
AND year = '$date'
However the following works:
$GetListNews = "SELECT * FROM news WHERE year = '$date' ORDER BY id desc";
so I think there is some sort of error with the last part of the query integrated at the same time with the parts which search (like) keywords.