The Lodge is members-only design/dev videos and Office Hours.

Next Office Hours Session: "Implementing an SVG Icon System" Nov 30 - 6:00 PM Eastern

Need help with PHP, mySQL and SimplePie

  • # August 8, 2012 at 1:03 pm

    I am building a website based on an RSS parser called SimplePie.

    I’ve been getting a headache trying to find a solution to what I thought was a simple problem.

    The code in question usually looks something like this:

     $feed->set_feed_url(array('', '')); 

    But I have a mySQL db that contains rows of URLs I am trying to insert dynamically.

    On StackOverflow, they suggested this:

     $rss_results = mysql_query("SELECT feed_id, feed_url, feed_title, feed_order, feed_page_id FROM user_feeds WHERE
    ((feed_owner = '" . $_SESSION . "'));");

    if ($rss_results) {

    $urls = array();
    while ($row = mysql_fetch_array($rss_results)) {

    $urls[] = $row;

    else {
    // something went wrong.
    echo mysql_error();

    The code seemingly works. But the feeds are not in the right order. Feed items are supposed to be listed by date. Instead, feed items are grouped by feed and then ordered by date.

    The feed items are arranged correctly when I manually insert the values of the feeds. So if the code provided by StackOverflow worked as intended, it would be working. So I don’t think this is a problem with SimplePie.


    When I insert gibberish into the code…

        $urls[] = "dfsf" . $row . "fsdf";

    … the feed items are ordered correctly, but entire feeds are missing.

    I can’t make any sense of this. What could be the problem? Any suggestions?

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.

There's a whole bunch of content on CSS-Tricks.

Search for Stuff   •   Browse the Archives

Get the Newsletter ... or get the RSS feed