JQuery autocomplete PHP MySQL help
Hi this is my first post!
I'm v new to JQuery, but already am excited about it. But am stuck on this because I can't find any real examples...
I want to link up the JQuery autocomplete module up to my MySQL database using PHP.
I've got the JQ part working fine. But I don't know how to display/format my PHP array? Should I just print_r() the array, or run through it and each out every value? Or do I display it in an unordered list?
It seems that echoing out each value (on their own or as a list item) screws up the JQ display.
JQuery:
-
$().ready(function() {
$("#name").autocomplete("/autocomp.php", {
width: 350,
selectFirst:false,
delay:10,
minChars:1,
matchCase:false,
mustMatch:false,
autoFill:false,
});
});
<input id="name" />
PHP:
-
$input = $_GET['q'];
# then do SQL to find matches for this
# return results as an array
# ... now how do I display this data ??
Thanks in advance