Значи имам някаква грешка но не мога да я намеря не иска да търси ..Ето index.html:
ftw.php
Някой може ли да ми помогне?
Код:
<html>
<head>
<title>Ajax , etc</title>
<script type="text/javascript" src="js/jquery-1.5.2.min.js"></script>
<script>
$(document).ready(function() {
$("#q").autocomplete("ftw.php" , {minChars: 3,formatItem: liFormat,maxItemsToShow: 10});
});
function liFormat(row,i,num) {
var result = '<li>' + row[0] + '</li>';
return result;
}
</script>
</head>
<body>
<input type="text" id="q" />
</body>
</html>
Код:
<?php
//header("Content-type: text/plain; charset=utf-8");
$q = $_GET['q'];
mysql_connect('localhost' , 'root' , '') or die (mysql_error());
mysql_select_db('catalog') or die (mysql_error());
mysql_query("SET NAMES cp1251");
$query = mysql_query("SELECT title FROM films WHERE title LIKE = '%$q%");
while($res = mysql_fetch_assoc($query)) {
echo "$row[title]";
}
?>