I'm new to PDO and prepared statements. Why does this work:
$sth = $dbh->prepare("SELECT *
FROM skyrim_ingredients
WHERE ing_name
IN ('blue butterfly wing', 'blue dartwing', 'blue mountain flower');");
while($row = $sth->fetch()) {
echo $row['ing_id'];
}
...but this doesn't:
$ing_string = 'blue butterfly wing', 'blue dartwing', 'blue mountain flower';
$sth = $dbh->prepare("SELECT *
FROM skyrim_ingredients
WHERE ing_name
IN (?);");
$sth->bindParam(1, $ing_string);
$sth->execute();
while($row = $sth->fetch()) {
echo $row['ing_id'];
}
I read that you cant use parameters for tables or columns, is this the case with IN clause, too?