Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End Need help with PHP, mySQL and SimplePie

  • This topic is empty.
Viewing 1 post (of 1 total)
  • Author
    Posts
  • #39264
    booruguru
    Participant

    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('http://www.tmz.com/rss.xml', 'http://rss.cbc.ca/lineup/topstories.xml')); 

    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;

    }
    $feed->set_feed_url($urls);
    }
    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.

    EDIT

    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)
  • The forum ‘Back End’ is closed to new topics and replies.