Hey All, I am trying to write a php script and would like to have an autosuggest text box with data from a mysql database. This would be for designating a town in a form.
The sql query I would use would be.

<?php
$connection = @mysql_connect($server,$dbusername,$dbpassword) or die(mysql_error());
$db = @mysql_select_db($db_name,$connection) or die(mysql_error());
$sql = "SELECT DISTINCT `Town` FROM '".$Table_Name."' ";
$result = @mysql_query($sql,$connection)or die(mysql_error());
?>

Then there would be a second autosuggest text box that would only select cemeteries in the town from the first box.

I have found a few tutorials on the web but can't seem to get them to work with a sql query.

The tutorial that I have been trying to use is located HERE.

The demo works fine but I cant get the results to show up from the sql query above. When I tested the sql query in the test.php file that I made it seems to work fine.

Does anyone have any suggestions??? Anyhelp is appreciated.

Recommended Answers

All 6 Replies

The script above performs a query but doesn't output anything. You will need an output from the script to populate the suggestions. What does the demo script look like?

Hi, Thanks for your reply. I have attached the three files that the demo uses. I am fairly new to javascript so I haven't messed with that. Again when I test the php page it showed up with the correct info.

buddylee17, Have you by any chance made any progress? Do you have any ideas on how to get it to work? I would appreciate the help.

Does anyone have any suggestions on how to get this to work. I would appreciate the help. I, myself, am stumped.

Narrow down the problem and post the code. Most of us aren't going to download your code.

ok guys, I think I have solved the problem. It was a simply a mis-reference. The script called on the town ID where I accidently renamed that to Town. I don't know if you guys understand what I was trying to say, bt anyway, I've got it solved. Thanks for the help.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.