Topic: RSS feeds from database + associated data (skip NULL in MySQL output)
I'm a non-PHP coder trying to copy/paste a script together, struggling with probably basic stuff. Google is no help. Most tutorials go deep into the PHP mechanisms and jargon with overly fancy examples.
I let registered PunBB users add an RSS feed to their user data. I want to get a list of available RSS feeds from the database and insert it into the SimplePie script that will show the latest users posts on a page.
$query="SELECT rssfeed FROM users";
$result=mysql_query($query);
$num=mysql_numrows($result);
mysql_close();
$i=0;
while ($i < $num) {
$rssfeed=mysql_result($result,$i,"rssfeed");
echo "$rssfeed,<br />";
$i++;
}
SimplePie requires something like this:
'http://www.website.com/?feed=rss2',
'http://feeds.feedburner.com/someonesblog',
'http://www.moreblogging.com/my_weblog/atom.xml',
The apostrophes are probably not essential, but the comma apparently is. With the code above I get lots of empty commas, because only a handful of people have submitted RSS feeds so far. How can I get the script to skip empty fields?
The echo output should then replace $memberfeeds in this bit of SimplePie code:
// Initialize some feeds for use.
$feed = new SimplePie();
$feed->set_feed_url(array(
$memberfeeds
));
How can I do that? This obviously doesn't work:
$memberfeeds=echo "$rssfeed,<br />"
Something like that, but looped so it produces a list of all available RSS feeds.
Again, I couldn't find anything online. It's becoming one of those obsessions that eating up all my time. All suggestions are very welcome, including what keywords to search on and links to good tutorials or examples for these basic things.
Happy New Year!