Hey all
I am trying to write a script that allows users to search through a
database of names. But rather than give a search string and then return
all those that match, I would like it to search each time the user
types a new letter in the text box.
That's badly explained - this example might help!
The user types "r" and I displays all the names with r in them. The
user continues and types "i" so the textbox shows "ri" and displayed
are all the results with "ri" in them. I as doing currently this by
re-querying the SQL database where the names are hosted but it takes
too long to query, return and refresh the page.
What would be a better way of storing this database info to allow a
faster search? Maybe load it into a PHP array first (stored in another
file) and search within that? (Can you do 'clever' searches in PHP?) Or
into a javascript array? The list could be upwards of 1000 names.
The databse shouldn't change that often so I could have a script that
updates the array every 24 hours or every time a new name is added.
Thanks in advance
I am trying to write a script that allows users to search through a
database of names. But rather than give a search string and then return
all those that match, I would like it to search each time the user
types a new letter in the text box.
That's badly explained - this example might help!
The user types "r" and I displays all the names with r in them. The
user continues and types "i" so the textbox shows "ri" and displayed
are all the results with "ri" in them. I as doing currently this by
re-querying the SQL database where the names are hosted but it takes
too long to query, return and refresh the page.
What would be a better way of storing this database info to allow a
faster search? Maybe load it into a PHP array first (stored in another
file) and search within that? (Can you do 'clever' searches in PHP?) Or
into a javascript array? The list could be upwards of 1000 names.
The databse shouldn't change that often so I could have a script that
updates the array every 24 hours or every time a new name is added.
Thanks in advance
Comment