shah rushabh shah rushabh - 1 year ago 83
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.

Answer Source

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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download