I have a short segment of PHP code:
$stm = $db->prepare($sql);
$result = $stm->execute($params);
$params is the following
array(1) {
[0]=>
string(3) "why"
}
However, the $sql being sent to MySQL still contains a question mark according to the MySQL logs:
1 Query SELECT a.* FROM article a
LEFT JOIN article_links al on a.id = al.from_article_id
WHERE al.to_article = '?'
Is there something else I’m missing for substitution?
You don’t need to have the single quotes around the question mark: