好吧...为什么这个sql语句不起作用?
public function searchProfile() {
$termino = $this->term;
$termino = "%".$termino."%";
$sql = "SELECT * FROM cat_perfiles WHERE UPPER(Nombre) LIKE UPPER(:term)";
$result = $this->dbConnect->prepare($sql) or die ($sql);
$result->bindParam(':term',$termino,PDO::PARAM_STR);
$numrows = $result->rowCount();
$jsonSearchProfile = array();
if ($numrows > 0) {
while($row = $result->fetch(PDO::FETCH_ASSOC)) {
$jsonSearchProfile[] = array(
'IdPerfil' => $row['Id'],
'NomPerfil' => $row['Nombre'],
'DesPerfil' => $row['Descripcion'],
'EdoPerfil' => $row['Activo']
);
}
$jsonSearchProfile['success'] = 'success';
return $jsonSearchProfile;
} else {
return false;
}
}
我检查了 $this->term 中的数据并且是正确的!但是当与 LIKE 比较时不起作用。
我希望能帮助我!