I have a simple search script to search a database which should return all the rows of data that match the search query that belong to that user, however my query (below) is returning rows from every user. Any idea how to fix this?
SELECT * FROM tablename
WHERE title LIKE '%" . $q . "%'
OR text LIKE '%" . $q . "%'
AND user='$user'
Side Note: This is executed in PHP so the $q is the variable that holds the query.
$useris a PHP variable, right?