The Mysql codeigniter query does not work correctly. Suppose the mysql table looks like this:
user_id|user_name
1|john
2|alex
3|sam
Here username is unique
The following query should return false if username = john and user_id = 1 and true if say user_name = john and user_id = 2 .
$this->db->get_where('user', array('user_name' => $name,'user_id !=' => $userid));
But it returns true in case of username = john and user_id = 1 .
Can someone suggest me an alternative way to request non-equal.
print ($ this-> db-> last_query ()) gives:
SELECT * FROM () WHERE user_name = 'john' AND user_id!= '1'