View Full Version : backend php for autocomplete

01-24-2008, 04:53 PM
I'm using the jquery autocomplete plugin found here....


and I'm getting confused over how the backend PHP code needs to be programmed when the data comes from a mysql db.

If I follow the example provided at the site, I'm led to believe that I simply echo the array of items pulled from the DB. However, I get absolutely no results in my autocomplete field. My PHP works perfectly fine when I test it by itself so I know I'm retrieving the data correctly

Here's an example of my PHP script


include ("connect.php");

$q = strtolower($_GET["q"]);
if (!$q) return;


$quer=mysql_query("SELECT * FROM owners where lname like '$q%' order by lname");
while($row = mysql_fetch_array($quer))
$arr[]=$row['lname'].', '.$row['fname'].'<br />';
foreach ($arr as $value)
echo $value;



Any insight is appreciated.



01-24-2008, 08:33 PM
Nevermind. I got it working.