Probilem outputting RSS Feed
Results 1 to 2 of 2

Thread: Probilem outputting RSS Feed

  1. #1
    Still not professional
    Join Date
    Aug 2006
    Posts
    191

    Probilem outputting RSS Feed

    Need a bit of advice. I found a RSS script and modified it for my own purposes.
    I am pulling the information from the database. Everything works fine. I can pull the title, and description and the rss feed works and is displayed correctly on screen.

    However my problem occurs when I need to add the link in the <link></link> tags.
    If I enter a url in the <link></link> tags, and try to display the rss page again, I just end up getting a blank page.

    I presume this is to do with the characters in the http:// part of the address?

    Wondering if you have any solution or shed some light on this?

    The script I am using is below.


    <?php

    //SET XML HEADER
    header('Content-type: text/xml');

    //CONSTRUCT RSS FEED HEADERS
    $output = '<rss version="2.0">';
    $output .= '<channel>';
    $output .= '<title>RSS Feed</title>';
    $output .= '<description></description>';
    $output .= '<link></link>';

    include('db_settings.php');
    $dbcnx = @mysql_connect("$servername","$username", "$password");
    if (!$dbcnx)
    { echo( "" );
    exit(); }

    // Connect to database
    if (! @mysql_select_db("$database") ) { echo( "<P>Unable to locate the database" . "" );
    exit();
    }


    // Request results from tables
    $result = mysql_query("SELECT * FROM articles ORDER BY date_posted");

    while ( $row = mysql_fetch_array($result) )
    {
    //BODY OF RSS FEED
    $output .= '<item>';
    $output .= '<title>'. $row['title'] .'</title>';
    $output .= '<description>'. $row['meta_description'] .'</description>';
    $output .= '<link>{Problem Occurs Here when I enter URL}</link>';
    $output .= '<pubDate>Date Published</pubDate>';
    $output .= '</item> ';
    }

    //CLOSE RSS FEED
    $output .= '</channel>';
    $output .= '</rss>';

    //SEND COMPLETE RSS FEED TO BROWSER
    echo($output);
    ?>

  2. #2
    Pedantic Curmudgeon Weedpacket's Avatar
    Join Date
    Aug 2002
    Location
    General Systems Vehicle "Thrilled To Be Here"
    Posts
    21,875
    When posting code, please use the formatting tags described in the FAQ to make it easier to read, thank you.

    How are you entering the URL? If you're going to post a lot of code there's no point only posting the stuff that's working.
    THERE IS AS YET INSUFFICIENT DATA FOR A MEANINGFUL ANSWER
    FAQs! FAQs! FAQs! Most forums have them!
    Search - Debugging 101 - Collected Solutions - General Guidelines - Getting help at all

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •