我需要我的身份驗證腳本來設置查詢,在WHERE子句中我想用'_MY_POST_VALUE' IN (Field1, Field2)
笨在哪裏值IN(字段1,字段2)
最終的查詢將會是這樣的:
SELECT * FROM 'myprefix_users' WHERE '[email protected]' IN ('EMAIL','LOGIN') AND PASSWORD=SHA1('mypassword')
我試着這樣做:
$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');
..但笨設置前綴我的登錄/電子郵件值和發送錯誤:
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 ''[email protected]' IN (EMAIL,LOGIN) AND PASSWORD=SHA1('123')' at line 3
SELECT * FROM (`myprefix_users`) WHERE myprefix_'[email protected]' IN (EMAIL,LOGIN) AND PASSWORD=SHA1('123')
我需要在表名使用db_prefix,但我並不需要它在我的WHERE子句中,即使第三參數(FALSE) - >其中,()不爲我工作:(
我該如何解決我的問題?有任何想法嗎?
你可以用你的查詢俗做的一樣好:) – Suleman 2012-07-05 15:45:03