I have this code
$marker = 'werkz';
$sql = "SELECT name, marker FROM sidebar";
$q = $db->query($sql);
$q->setFetchMode(PDO::FETCH_ASSOC);
while ($r = $q->fetch()) {
echo'<option>' . $r[name] . '</option>';
}
It works but when I add WHERE marker = $maker; the query fails.
What is the problem?
since you are using
PDO, do it like this when passing parameter.