I'm trying to use an ajax/php autocomplete script from an article I found. When I use this code it works ok...
$sql = "SELECT name FROM artists WHERE name LIKE '%" . $_POST['searchterm'] . "%'";
$rs = mysql_query($sql);
?>
<ul>
<? while($data = mysql_fetch_assoc($rs)) { ?>
<li><? echo stripslashes($data['name']);?></li>
<? } ?>
</ul>
but when I try to use this example to pass the id it fails
echo "<ul>";
$sql = "SELECT * FROM artists WHERE name LIKE '%" . $_POST['searchterm'] . "%’";
$rs = mysql_query($sql);
while($data = mysql_fetch_assoc($rs)) {
echo "<li id=\"" . $data['id'] . "\">" . $data['name'] . "</li>";
}
echo "</ul>";
?>
can anyone spot whats wrong?