当前使用Slim PHP编写预备语句。 我可以在查询为
时进行检索select * FROM doctor
但是,一旦我更改为
select * FROM doctor d, user u where d.doctor_nric=u.doctor_nric;
系统将返回空值。 我已经在mySQL上尝试过,它可以正常工作。知道我的代码哪一部分出错了吗?
public function getAllDoctor()
{
$stmt = $this->con->prepare("select * FROM doctor d, user u where d.doctor_nric=u.doctor_nric;");
$stmt ->execute();
$stmt->store_result();
$stmt ->bind_result($doctor_nric,$doctor_name,$doctor_contact);
$doctors = array();
while($stmt->fetch())
{
$data= array();
$data['nric']=$doctor_nric;
$data['name']=$doctor_name;
$data['contact']=$doctor_contact;
$data['user_id']=$doctor_id;
array_push($doctors,$data);
}
return $doctors;
}