Hi, please can someone tell me why the above code does not work.
$GetListNews = "SELECT * FROM news WHERE title LIKE '%$searchQuery%' OR copy LIKE '%$searchQuery%' OR teaser LIKE '%$searchQuery%' AND year = '$date' ORDER BY id desc";
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
However the following works:
AND year = '$date'
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.
$GetListNews = "SELECT * FROM news WHERE year = '$date' ORDER BY id desc";