Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/70.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/file/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 如何在mysqli prepare语句中插入pourcentage符号%?_Php_Sql_Mysqli - Fatal编程技术网

Php 如何在mysqli prepare语句中插入pourcentage符号%?

Php 如何在mysqli prepare语句中插入pourcentage符号%?,php,sql,mysqli,Php,Sql,Mysqli,我想运行下面的代码: 但它显示了一个错误 $stmt = $this->con->prepare("SELECT HEUREDEB , HEUREFIN from reservation where ID_EMPL = ? and HEUREDEB like ?%"); $stmt->bind_param("ss",$ID_EMPL,$HEUREDEB); $stmt->execute(); $re

我想运行下面的代码:

但它显示了一个错误

$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();
使用CONCAT

您也可以将其添加到变量中

$HEUREDB .= '%';
$stmt = $this->con->prepare("SELECT HEUREDEB , HEUREFIN from reservation 
where ID_EMPL = ? and HEUREDEB like ?");
$HEUREDB .= '%';
$stmt = $this->con->prepare("SELECT HEUREDEB , HEUREFIN from reservation 
where ID_EMPL = ? and HEUREDEB like ?");