Jump to content

Help with a simple search engine


migroo

Recommended Posts

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

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

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

It works wonderfully!Thank you again.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...