SELECT * FROM table_name WHERE column_name LIKE '%$search%' AND WHERE NOT column_name='$id';
I want to select all the results from my database that are like my search term, but exclude the row that is equal to my php variable $id.
Is it possible to do this in a MySQL query?
Put the all the conditions inside a single WHERE
block and use conditional operators like AND/OR/NOT
to combine them
SELECT * FROM table
WHERE `row` LIKE '%$search%' AND
`row` <> '$id';
Also, please learn to use Prepared Statements