我在PDO中有下面的代码,并且我想将:pseudovalue和Like运算符“%”组合在一起,但是我不能同时使用两者!
该怎么做?
// PHP/PDO CODE
$query = 'whatever';
try{
$search = $connect->prepare('SELECT * FROM products WHERE manufacturer LIKE %:query%');
$search->bindValue(':query', $query);
$search->execute();
}catch(PDOExeption $e){
$e->getMessage();
}
echo $search->rowCount();
while($data = $search->fetch(PDO::FETCH_ASSOC)){
echo $data['name'];
}