Forum Moderators: coopster
What I want to do is have a setup where every time a page on my site loads, a database is checked to see if certain words in the title of the page appear in the list of words in the database. This would trigger a list of links to other pages that also have those words in the title. The question is not how to get the list of related stuff displayed, but the best way to setup the table for the title word check.
How do you do word matching using a database? Specifically, how do you store the data? Should it just be rows and rows of words or should it be a main word (e.g. shoes) followed by related words on the same row (say, a bunch of related words in a text field, e.g., shoe, high heels, boots, flip flops).
Not looking for specifics or even PHP code, just a "best practices" for such a setup.
TIA
Instead of leaving the script ignorant of the page it's on and making it parse the title on every page load, create a database of page IDs and their associated keywords.
This saves the parsing step. Instead the script can grab the keywords directly from the page's database row (which contains the page ID as the primary key and the keyword list as another) and then use them to retrieve the other pages.
If this is for an existing site you can write a quick utility to parse through it and create database entries for each page.