Create code in PHP and Javascript that performs an incremental search against a remote MySQL table in real-time, as a user types in a textbox, returning the partial matches found so far in a listbox on-screen.
The function should be written in PHP and Javascript and should use AJAX to return the incremental results from the MySQL query. The code must work in both IE6+ and Firefox 2+.
## Deliverables
The supplied code should be written in PHP and Javascript, and must run against a remote MySQL database using AJAX.
Here's the pseudocode for the functionality, as I envision it:
In a browser:
Show an empty text box.
Wait for a keystroke within the text box
While key pressed within text box and elapsed time<1 second
Wait for a keystroke within the text box
reset elapsed time timer
}
Send query to mysql table like this:
SELECT name from table where name LIKE '<contents of textbox>%';
Update a listbox with returned names
The "elapsed time" code above is to prevent a lot of churning fetching incremental search results. The idea is to not make any database queries until at least 1 second has elapsed since that last keystroke within the browser.
Prepare an HTML page demo-ing the function that you've written.
The page should take user input and show the results of the incremental mysql search on-screen.
The demo should NOT use localhost as the source for the mysql data, but should use a remote server (the successful bidder can use mine, if he likes).