我想运行以下代码:
但显示错误。
$stmt = $this->con->prepare("SELECT HEUREDEB , HEUREFIN from reservation
where ID_EMPL = ? and HEUREDEB like ?%");
$stmt->bind_param("ss",$ID_EMPL,$HEUREDEB);
$stmt->execute();
$result=$stmt->get_result();
答案 0 :(得分:1)
使用CONCAT()
。
$stmt = $this->con->prepare("SELECT HEUREDEB , HEUREFIN from reservation
where ID_EMPL = ? and HEUREDEB like CONCAT(?, '%')");
您也可以将其添加到变量中。
$HEUREDB .= '%';
$stmt = $this->con->prepare("SELECT HEUREDEB , HEUREFIN from reservation
where ID_EMPL = ? and HEUREDEB like ?");