CodingForums.com

CodingForums.com (http://www.codingforums.com/index.php)
-   PHP (http://www.codingforums.com/forumdisplay.php?f=6)
-   -   Organizing Mysql search (http://www.codingforums.com/showthread.php?t=282277)

comport9 11-15-2012 06:44 PM

Organizing Mysql search
 
I have a database with rss feeds with each feed having one or more categories. What I'm trying to do is display the feeds within their respective categories. My first step though, I can't figure out the best way to get the categories organized.

Example:
Feed 1 / Local News / New York
Feed 2 / Local News / LA
Feed 3 / World News

I don't imagine having thousands of different feeds, so I did a query putting everything into an array.

So, here's what I have so far. (It's laughable, I know...)

Code:

$rssSelect = "SELECT * FROM rss";
$rssSet = mysql_query($rssSelect);
while ($rssRow = mysql_fetch_array($rssSet)) {
        $mainCats[] = $rssRow['id'];

Code is incomplete of course. I want all the "Local News" into an array with each feeds 'id' being linked to it. I then want sub categories linked to the main category. (In this way I hope to be able to sort through them to produce the necessary HTML). I'm having trouble figuring out how to get it done with the fewest lines/variables as possible.

This would be nice:
Array
Local News = (1, 2)
World News = (3)

Array
New York = (Local News)
LA = (Local News)

I should be able to sort through stuff from there... I hope I'm making sense. Thanks!


All times are GMT +1. The time now is 02:25 AM.

Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.