我有一个错误的雄辩查询意外:!=

时间:2015-04-08 11:14:18

标签: eloquent

我的查询如下:

 $users = User::where("admin", <>, '1')->where('id', <>, $my_id)->get();


The error is the following:

Sintax error

unexpected: !=
after ','
expected: exit, integer, double, identificer, STRING, VARNAME, variable, String, String, clone, function, isset, empty, list, array, _CLASS, _METHOD, _FUNCTION, _NAMESPACE, _DIR_, ª, define, include, include_once, eval, require, require_once

POSSIBLE Syntax Error (check preceding valid syntax error)
unexpected: !=
POSSIBLE Syntax Error (check preceding valid syntax error)
unexpected: )
Introduce Variable 
-----
(Alt-Enter shows hints)

我不知道错误。有人可以帮助我。谢谢! 期望退出,整数,双精度,标识符,STRING_VARNAME

1 个答案:

答案 0 :(得分:0)

因为您不能只传递<>!=,所以它必须是字符串

$users = User::where("admin", "<>", '1')->where('id', "<>", $my_id)->get();