Pythondesigns Posted October 24, 2006 Share Posted October 24, 2006 Hello,I am trying to create a search feature in PHP where my users can type in keywords and it will return the results.But it will be using two tables and use a sort of tag system. Here are my tablestags([u]id[/u], tag);files([u]id[/u], title, desc, url, tagIDs*);Ok, if for example someone typed into the search form the keywords "apple ipod". I want it to search the tags table for first "apple" and then "ipod". If those tags arent already present in the tags table insert them. If they are present then get their ID's.Then search through the files table for all rows which has got the tag's ID in the tagIDs field. Then display the result and if possible order them by relevance.So basically this is a search script which keeps track and records the different keywords used and assigns each record in the files table a number of tags. The tagIDs field in the files table can contain more than one tag ID.Could any one show me how I could do this.Thanks Quote Link to comment Share on other sites More sharing options...
jvrothjr Posted October 24, 2006 Share Posted October 24, 2006 First question is why have a TAG table why not just search the file table for the data. This search Tag if not there add will be more time then just searching the file table for keyword?Second what field(s) are you searching in the files table with the keyword?May thought on this would be you would need to search files every time anyway to catch the new records so why do a search for tagIDs and keywords?[code=php:0]("select * from files where title like '%$Keywords%' or desc like '%$Keywords%' or url like '%$Keywords%'")[/code] Quote Link to comment Share on other sites More sharing options...
Pythondesigns Posted October 24, 2006 Author Share Posted October 24, 2006 Its ok Ive figured it out.Thanks Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.