shah rushabh shah rushabh - 5 months ago 30
MySQL Question

MYSQL not equal '<>' not working. How to resolve it?


$data=$this->db->query("SELECT * FROM `ads` WHERE (`UniqueID` IN ($uniqueids)) AND 'EmailAddress' <> '$email'")->result_array();

Value of $email is it appearing in result so which mistake I made please resolve it.


You have single quotes around the column name, so your emailaddress is compared to the string not the column value:

'EmailAddress' <> '$email'

Remove the single quotes around EmailAddress

EmailAddress <> '$email'

and it will work.