Reputation: 16152
The following syntax is the current syntax I have that's works.
$dbh = connect();
$singer = strtolower($_GET["singer"]);
$SQL =
"SELECT *
FROM table
WHERE field1 LIKE ?
ORDER BY field2 ASC";
$sth = $dbh-> prepare ($SQL);
$sth->bindParam (1, $singer);
$sth->execute();
What changes do I need to make to the line of code WHERE field1 LIKE ?
to perform the query with the wildcard %
?
I've tried WHERE field1 LIKE '%?%'
but that didn't work.
Do I have to prepend '%
and append %'
to the value stored in $singer
?
Upvotes: 2
Views: 4525