Bonjour,
Dans la requête ci-dessous, j'ai l'erreur
number of bound variables does not match number of tokens
Pourtant ma requête comporte deux paramètres dans la requête et deux paramètres dans le tableau des variables.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
function searchPersons(int $idAbo, string $qString): array|false {
	$db = dbConnect();
 
	$sql = <<<SQL
	SELECT id, lastname, firstname, CONCAT( COALESCE(birthday, '--'), '/', COALESCE(birthmonth, '--'), '/', COALESCE(birthyear, '----') ) AS birthdate,
	CONCAT(id, lastname, firstname, birthdate) AS searchString
	FROM dat_persons
	WHERE id_abo=:id_abo AND searchString LIKE '%:qString%'
	SQL;
	$stmt = $db->prepare($sql);
	$stmt->execute([':id_abo'=>$idAbo, ':qString'=>$qString]);
	return $stmt->fetchAll();
}