Query related content like youtube.com

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
banmidou
Forum Newbie
Posts: 2
Joined: Sat Oct 03, 2009 9:24 pm

Query related content like youtube.com

Post by banmidou »

This is my table structure:
news(
id,
title,
keyword,
picture,
description,
content
)
When i user read a news, i want to display related news like this one ( like related video on youtube) . I don't know how to query it.
Please help me.
Thanks for reading.
iamngk
Forum Commoner
Posts: 50
Joined: Mon Jun 29, 2009 2:20 am

Re: Query related content like youtube.com

Post by iamngk »

you can apply FULLTEXT search for keyword, description column. When you fetch the data for current news, you will get the keyword of that news. You can do the query like below.

Code: Select all

//$current_news_keyword   should be keyword of current news.
$query = “select * from news where match (keyword, description) against (‘”. $current_news_keyword   .”’)”;
It is just idea. You can implement exact search you want.
banmidou
Forum Newbie
Posts: 2
Joined: Sat Oct 03, 2009 9:24 pm

Re: Query related content like youtube.com

Post by banmidou »

Thanks a lot. I'm working with fulltext search.
Post Reply