Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 11-15-2012, 06:44 PM   PM User | #1
comport9
New Coder

 
Join Date: Oct 2012
Posts: 25
Thanks: 2
Thanked 0 Times in 0 Posts
comport9 is an unknown quantity at this point
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!
comport9 is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 06:14 AM.


Advertisement
Log in to turn off these ads.