我使用一个库来帮助我使用 db 功能。这是一个有效的语法:
if ($memID = $db->get_var("SELECT id FROM users WHERE social_id = ".$_SESSION['user'])) {
// user found
$db->query("
UPDATE users
SET
nameF = '".$NameF."',
nameL = '".$NameL."'
WHERE id = ".$memID."
LIMIT 1");
} else {
// user not found
}
我需要添加额外的检查:
if ($memID = $db->get_var("SELECT id FROM users WHERE social_id = ".$_SESSION['user']) ||
$memID = $db->get_var("SELECT id FROM users WHERE email = '".$Email."' AND password IS NULL") ||
($_COOKIE['socid'] != '' && $memID = $db->get_var("SELECT id FROM users WHERE FIND_IN_SET(social_id, '".$_COOKIE['socid']."'))
){
}
但我认为我过于复杂了,并在此过程中引入了错误。我究竟做错了什么?