migroo Posted June 8, 2010 Share Posted June 8, 2010 I have a web page that displays a MYSQL data table. Here is an example of what the data table looks like:First_Name: Last_Name: Age: About: John Stern 40 Something about him. James Carl 82 Information about James Carl. Adam Hill 50 Just a little info about him.I Have a page displaying everything as a default but I want people to be able to refine their searches.Right now using AJAX people can search by First Name, Last Name or Age.Now if they search "J" under First Name it wont pop up with anything. But if they search for "John" under First Name they will get "John Stern Age: 40 Something about him".What I am trying to do is make it so you can type "J" and get all the names that start with J. I have bean hunting all over the place and I am not sure how to attack this problem.Any help would be much appreciated.Thanks Link to comment Share on other sites More sharing options...
thescientist Posted June 8, 2010 Share Posted June 8, 2010 probably need to use some sort of wildcard character, I think in SQL its *? something along those lines.http://www.w3schools.com/php/php_mysql_select.asp Link to comment Share on other sites More sharing options...
ShadowMage Posted June 8, 2010 Share Posted June 8, 2010 probably need to use some sort of wildcard character, I think in SQL its *? something along those lines.Actually it's '%' but yeah I think that's probably the right approach. You would need to send the AJAX request with the onkeyup event (but you're probably already doing that ) Link to comment Share on other sites More sharing options...
thescientist Posted June 8, 2010 Share Posted June 8, 2010 darn. I had * or % originally but then I saw * in the link and just went with that instead. :)in light of that, read this link instead! http://www.w3schools.com/SQL/sql_wildcards.asp Link to comment Share on other sites More sharing options...
migroo Posted June 9, 2010 Author Share Posted June 9, 2010 It works wonderfully!Thank you again. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.