public function Question()
{
return $this->belongsTo('Question', 'QuestionId', 'QuestionId')->bind('Title');
}
public function Questionoption()
{
return $this->belongsTo('Questionoption', 'AnswerId', 'OptionId')->bind('Content');
}
public function UserLog(){
return $this->belongsTo('userlog', 'UserId', 'UserId')->bind('IsFinish');
}
public function UserList(){
return $this->belongsTo('userlist', 'UserId', 'UserId')->bind('NickName,Sex');
}
public function getQuestss($request)
{
$get = $request->param();
$map = array();
if (isset($get['State'])){
$map['IsFinish'] = $get['State'];//加上判断就报错
}//加上判断就报错 $data = $this->with('Question,Questionoption,UserLog,UserList')->where($map)->select()->toArray();
print_r($data);die;
报错:SQLSTATE[42S22]: Column not found: 1054 Unknown column 'IsFinish' in 'where clause'
没有加条件语句的时候就是这样的数据结构 加了where 就报错不加where打印出来的是Array(
[0] => array(
[Isfinish] =>1
[NickName]=>pt
[sex] =>男
)
) 最佳答案