0
$keywords = "example";
$sql = "SELECT * FROM example WHERE column LIKE '%?%'";
$stmt = $pdo->prepare($sql);
$stmt->execute([$keywords]);

I want to return rows Which keywords LIKE the user Input and I tried to do using PDO prepare statements.And this returns an error.Is there any other way to do this task.Appreciate your help thanks.

  • The wildcard needs to go on the variable (or use CONCAT('%',?,'%')), and the placeholder should not be quoted. Right now you're literally passing in `%?%` as the value to search for – aynber Jul 15 '21 at 14:19

0 Answers0