...

View Full Version : php5/mysql finding/display records by 1st letter, then 2nd letter, etc



steve800
04-14-2009, 12:12 AM
I'm relatively newbie ... but... Is there any way to use a form to search a client table by entering the first letter of the client's last name to narrow the list, then enter the 2nd letter to narrow the search further, etc? with more than 4,000 client records it would be nice to look for "Baker, Thomas" by starting with a "B", then the "a", then the "k", and so on....

Any assistance would be greatly appreciated.

Fumigator
04-14-2009, 12:18 AM
This kind of interactivity will require the use of AJAX. The general process is use Javascript to catch the "keypress up" or "change" event of the text box, which fires off an AJAX request with the contents of the text box, performs a SELECT whatever WHERE last_name LIKE 'string%', and returns the results back to your page. The easy part, really, is the PHP script, which is the simple SELECT and return of results. The more involved part is the AJAX call. You may find more help on that over in the AJAX forum.

CFMaBiSmAd
04-14-2009, 12:21 AM
An example of that process - http://w3schools.com/php/php_ajax_suggest.asp



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum