我有这方面的编码,有人可以帮助我使查询正确,我以为我有它但我只是收到一个查询错误
原始代码:
$q=$db->query("SELECT u.*,g.* FROM users u LEFT JOIN gangs g ON g.gangID=u.gang WHERE u.user_level != 2 $myf ORDER BY level DESC,userid ASC LIMIT 20");
我的编辑代码失败:
$q=$db->query("SELECT u.*,g.* FROM users u LEFT JOIN gangs g ON g.gangID=u.gang WHERE u.user_level != 2 || WHERE u.user_level !=0 $myf ORDER BY level DESC,userid ASC LIMIT 20");
答案 0 :(得分:1)
使用此
$q=$db->query("SELECT u.*,g.* FROM users u LEFT JOIN gangs g ON g.gangID=u.gang WHERE u.user_level != 2 || u.user_level !=0 $myf ORDER BY level DESC,userid ASC LIMIT 20");
你不能把两个放在Clause
答案 1 :(得分:0)
代替
$q=$db->query("SELECT u.*,g.* FROM users u LEFT JOIN gangs g ON g.gangID=u.gang WHERE u.user_level != 2 || WHERE u.user_level !=0 $myf ORDER BY level DESC,userid ASC LIMIT 20");
你应该,(删除第二位)
$q=$db->query("SELECT u.*,g.* FROM users u LEFT JOIN gangs g ON g.gangID=u.gang WHERE u.user_level != 2 || u.user_level !=0 $myf ORDER BY level DESC,userid ASC LIMIT 20");