Welcome to WebmasterWorld Guest from 18.207.136.184

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

pulling out related information with PHP from a MySQL database table

     
7:03 pm on Jul 29, 2009 (gmt 0)

New User

10+ Year Member

joined:May 12, 2006
posts: 21
votes: 0


I'm working on a site that displays various articles.. once a specific article is displayed, other articles with similar content would be suggested for that user to read. I'm trying to wrap my mind around the logic of this.. but I'm not really sure what would be the best approach to go about it.

Do I use user submitted tags? Or, would it be better to use a MySQL search script by querying the title of the article that's currently displayed and having the results show up beside it?

Any suggestions? Could anyone recommend some tutorials related to developing something like this?

12:27 pm on July 30, 2009 (gmt 0)

Junior Member

10+ Year Member

joined:Nov 10, 2006
posts:140
votes: 0


One suggestion would be to categorise the articles, and when an article displayed, have other latest articles under the similar category be displayed.
12:57 pm on July 30, 2009 (gmt 0)

New User

10+ Year Member

joined:May 12, 2006
posts: 21
votes: 0


Thanks for the suggestion mvaz. :)

The articles would be user submitted.. so then I guess I'd have to give users the option to select a category that the article they write falls in. But, the thing is, I'd like to avoid that.. i.e. ideally, I'd be able to categorize the articles seemlesly by the text that they contain.

That's why I was thinking of possibly using the title of the article to search trhough other articles for similar terms and displaying the articles that contain some or all of the terms. Would this be a valid approach or is there a better way to go about it?

2:08 pm on July 30, 2009 (gmt 0)

New User

10+ Year Member

joined:May 12, 2006
posts:21
votes: 0


So it seems I could use the similar_text PHP function..

<?php
similar_text("Hello World","Hello Peter",$percent);
echo $percent;
?>

So this would return the level of similarity btween the strings "Hello World" and "Hello Peter". But would I beable to use this to compare strings within a table field?

ie. could I do something like

<?php
similar_text(SELECT article1 FROM..,"SELECT articles to compare to FROM...,$percent);
echo $percent;
?>

I guess this would require me to loop through all other articles in the column and return them in order of similarity. But, somehow this seems a bit inefficient.. I mean, if there are thousands of articles that this would have to loop through. Any suggestions?

 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members