如何修复此SQL查询?
$q = $db->sqlQuery("SELECT * FROM project WHERE email = " . $email . "");
答案 0 :(得分:2)
$q = $db->sqlQuery("SELECT * FROM project WHERE email = '" . $email . "'");
答案 1 :(得分:2)
$q = $db->sqlQuery("SELECT * FROM project WHERE email = '$email'");
答案 2 :(得分:1)
你可以试试这个:
$q = $db->sqlQuery("SELECT * FROM project WHERE email = '" . $email . "'");
它缺少单引号'
,它应该包含$email
值,因为它是一个字符串。
答案 3 :(得分:1)
$q = $db->sqlQuery("SELECT * FROM project WHERE email = '" . $email . "'");
您需要使用''作为字符串变量
错误:SELECT * FROM project WHERE email = email@email.email
好的:SELECT * FROM project WHERE email = 'email@email.email'
答案 4 :(得分:0)
转义参数。
$q = $db->sqlQuery("SELECT * FROM project WHERE email = '" . $email . "'");