I need to set query in my auth script, where in WHERE clause I want to use '_MY_POST_VALUE' IN (Field1, Field2)
Final query will be something like this:
SELECT * FROM 'myprefix_users' WHERE 'myemail@email.com' IN ('EMAIL','LOGIN') AND PASSWORD=SHA1('mypassword')
I've tried to do this:
$this->db->where("'" . mysql_escape_string($_POST['login']) . "' IN (EMAIL,LOGIN)", NULL, FALSE);
$this->db->where("PASSWORD=SHA1('" . mysql_real_escape_string($_POST['password']) . "')");
$userdb = $this->db->get('users');
..but CodeIgniter set prefix to my login/email value and send error:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''test@test.com' IN (EMAIL,LOGIN) AND PASSWORD=SHA1('123')' at line 3
SELECT * FROM (`myprefix_users`) WHERE myprefix_'test@test.com' IN (EMAIL,LOGIN) AND PASSWORD=SHA1('123')
I need to use db_prefix in table name, but I don't need it in my WHERE clause, even third param (FALSE) in ->where() don't work for me :(
How can I solve my problem? Any ideas?