0
嗯...爲什麼不工作這個SQL語句?PDO:像條件不工作使用bindParam
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比較不起作用。
我希望能幫到我!
噢噢噢,是的!我怎麼能忘記,謝謝! :) – SoldierCorp