Re: Return Results in Categories - like CNET

From: Date: Fri, 16 Aug 2002 22:21:21 +0000
Subject: Re: Return Results in Categories - like CNET
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-21184@lists.php.net to get a copy of this message
I am just trying to return a few results from each category. like this: http://cnet.search.com/search?timeout=3&q=php sql query example: SELECT id, article_date, category, region, title FROM articles WHERE MATCH (title,article) AGAINST ('$search_word'); There are 20 possible categories that may return so multiple selects could provide what I need - but not much sense in running 20 queries for each search Here is an example that would work by running multiple queries. SELECT id, article_date, category, region, title FROM articles WHERE MATCH (title,article) AGAINST ('$search_word') AND category = 'news' LIMIT 0,5; /* display up to 5 news category matches and link to 'more news results' */ SELECT id, article_date, category, region, title FROM articles WHERE MATCH (title,article) AGAINST ('$search_word') AND category = 'features' LIMIT 0,5; /* display up to 5 news category matches and link to 'more features results' */ SELECT id, article_date, category, region, title FROM articles WHERE MATCH (title,article) AGAINST ('$search_word') AND category = 'coverstory' LIMIT 0,5; /* display up to 5 coverstory category matches and link to 'more coverstory results' */ --- Raphael Pirker <raphaelp@nr1webresource.com> wrote: > top 5 based on what? if it's numbers or plain text > you could use ORDER, if > it's a search query you'd use LIMIT 0,5 > > Cheers, > > Raphael > > __________________________________________________ Do You Yahoo!? HotJobs - Search Thousands of New Jobs http://www.hotjobs.com

« previous php.db (#21184) next »