Hi all
I am developing a system which requires a similar feature to that which Facebook has when you tag a friend in a picture, in that you type the first character of the name and on the onKeyPress event the friends list reduces to those results which match the characters you have typed. This is going to be used to keyword tag media files, artilces, blog entries, basically anything a user can upload to a website to be published. The keywords associated witll be used in the mysql FULL TEXT serching to find the records.
I have 2 ideas on how to achieve this and wondered if anyone has any thoughts or improvements to add.
Firstly, I have a table which contains a list of keywords which have been added into the system via a method which is not relevant to this topic. This table is simply an auto increment id field with a keyword string field. (ID | KEYWORD)
When a user wants to assign a keyword to a record, my 2 solutions to pull out the matched keywords from my table above are as follows:
1)
With every onKeyPress event, run an AJAX function to execute a query which checks the table for any rows which are %LIKE% the value of the text box.
OR
2)
Run one query which stores all of the rows in the table into an array, and then with every onKeyPress event, somehow filter and reduce the results from the array.
Obviously the latter requires less queries on the database however I am unsure how to code the latter in that I do not know how to keeping deleting array values that do not match the text box value to only leave those values which do match!
Anyway, if anyone has any thoughts I would grately appreciate your comments.
regards
doug