MySQL query returning rows from every user

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.

Leave a Reply

*

Hire Me
Follow Me!
Search
Most Popular Articles & Pages
Because your vote is Important
Sorry, there are no polls available at the moment.
Categories