Install firebug into firefox. Then have it open with concole enabled to see it fire off the jquery ajax events and you will see the return type and if there are any errors. This will make it a bit easier for you to debug.
Yes its in my website and same directory.
There is progress now. I changed the php code slightly and i can print the results from the table when I just select the rows from the table, but the problem is within the condition part. when i add the condition to check the string value, nothing is returned that matched the user input
<?php
$dbhost = 'hidden';
$dbuser = 'hidden';
$dbpass = 'hidden';
$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql');
$dbname = 'hidden';
mysql_select_db($dbname);
if(!$conn) {
// Show error if we cannot connect.
echo 'ERROR: Could not connect to the database.';
} else {
// Is there a posted query string?
if(isset($_POST['inputString'])) {
$queryString = $conn->real_escape_string($_POST['inputString']);
if(strlen($queryString) >0) {
$sql = 'SELECT destination FROM mytable WHERE destination LIKE "%' . $queryString . '%" ' ;
$result = mysql_query($sql);
while ($row = mysql_fetch_array($result))
{
// Format the results, im using <li> for the list, you can change it.
// The onClick function fills the textbox with the result.
// YOU MUST CHANGE: $result->value to $result->your_colum
echo '<li onClick="fill(\\''.$result->value.'\\');">'.$result->destination.'</li>';
print "<td>" . $row["destination"] . "</td>";
}
}
}
}
?>
Thanks guys. I found a good example with JQuery. I implemented it but it doesnt populate the input field with the data as the user types it. There are no error messages. There is a form and a php file that does the processing: the codes are shown below:
PHP Code:
<?php
$dbhost = 'hidden';
$dbuser = 'hidden';
$dbpass = 'hidden';
$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql');
$dbname = 'hidden';
mysql_select_db($dbname);
if(!$conn) {
// Show error if we cannot connect.
echo 'ERROR: Could not connect to the database.';
} else {
// Is there a posted query string?
if(isset($_POST['inputString'])) {
$queryString = $conn->real_escape_string($_POST['inputString']);
if(strlen($queryString) >0) {
$query = $conn->query("SELECT * FROM mytable WHERE destination LIKE '$queryString%' LIMIT 10");
// While there are results loop through them - fetching an Object (i like PHP5 btw!).
if ($query) {
while ($result = $query ->fetch_object()) {
// Format the results, im using <li> for the list, you can change it.
// The onClick function fills the textbox with the result.
// YOU MUST CHANGE: $result->value to $result->your_colum
echo '<li onClick="fill(\\''.$result->value.'\\');">'.$result->destination.'</li>';
}
}
else {
echo 'ERROR: There was a problem with the query.';
}
}
}
}
?>
The host have most likely set a custom trust level which does not support custom class libs. jQuery should still work for you, take a look here: http://docs.jquery.com/Plugins/Autocomplete
How can it support asp.net but not ajax? As far as I know, the jquery library is all javascript. Aside from jquery, I know raw javacript has the ability to make asynch server calls, but I don’t have any experience doing that. Have you actually tried uploading the jquery library and using it?
my site doesnt support ajaxcontroltoolkit. i download it last week and it didnt work with any ajax controls. My host told me it doesnt support it. that why i need an alternative.
This is the reply I got from my host: Unfortunately, the ASP.net AJAX Control Kit being an unofficial and community supported released addon of ASP.net AJAX, is not available on shared Windows hosting plan.
That’s just dumb on their part. I can’t imagine what they’ve done to disable it aside from maybe blocking asynchronous calls to the server. And if that’s the case, then there simply ARE no alternatives. AFAIK…