我正在从数据库中选择数据,我似乎找不到错误
$check = DB::select("select * from accounts where username = ".$data['username']);
已指出错误:
SQLSTATE [42S22]:找不到列:1054中的未知列'aizen' 'where子句'(SQL:从用户名= aizen的帐户中选择*)
答案 0 :(得分:1)
尝试这个
先获取数据。
$check = DB::select("select * from accounts where username = ?",[$data['username']]);
第二秒即可获取数据。
$check = DB::select("select * from accounts where username = :userName",['userName' => $data['username']]);
答案 1 :(得分:0)
请尝试,
$check = DB::table('table name')->where("column name",'=',"$value")->get();