此查詢不適用於我。我犯了什麼錯誤。請幫助與多個AND運算符的MySQL查詢
$sql="SELECT * FROM $tbl_name WHERE (username='$myusername' and (password='$mypassword' and password='$encrypted_mypassword'))";
此查詢不適用於我。我犯了什麼錯誤。請幫助與多個AND運算符的MySQL查詢
$sql="SELECT * FROM $tbl_name WHERE (username='$myusername' and (password='$mypassword' and password='$encrypted_mypassword'))";
未經檢驗的,但這應該工作,
$sql="SELECT * FROM $tbl_name WHERE
Username = '$myusername' AND
Password = '$mypassword' AND
Password = '$encrypted_mypassword'";
對於你在做什麼括號不是必需的,而且你也嘗試比較單場可能2個不同的值。
我假設你接受了簡單的密碼和加密的密碼。試試這個...
SELECT * FROM $tbl_name WHERE username='$myusername' AND
(password='$mypassword' OR password='$encrypted_mypassword')
如果只有加密的密碼,試試這個...
SELECT * FROM $tbl_name WHERE username='$myusername' AND
password='$encrypted_mypassword'
我試過了但它不起作用 – BSO
@BSO - 它怎麼不工作? –
怎麼不起作用? –