Skip to content Skip to sidebar Skip to footer

Pdo : Prepare With Bindvalue And Like %

I've looked over an hour on various website but I couldn't solve my problem. So here is the code that works: $animes = array(); $q = $this->_db->query('SELECT id, nom, no

Solution 1:

you did not execute().

after binding you need to execute then fetch:

$q->bindValue(':n',"%code%",PDO::PARAM_STR);
$q->execute();  
while ($data = $q->fetch(PDO::FETCH_ASSOC))

you can bind like this with php variable:

$q->bindValue(':n','%'.$var.'%',PDO::PARAM_STR);

Post a Comment for "Pdo : Prepare With Bindvalue And Like %"