Trouble With Dynamic RSS Feed

Discussion in 'HTML & Website Design' started by scottlpool2003, Jun 1, 2010.

  1. #1
    Works fine in PHP but it needs to be XHTML.

    http://www.crazyassthings.com/rss.php (Works fine)
    http://www.crazyassthings.com/rss.xhtml (Errors)

    I'm no good with XHTML but I should grasp what you mean.

    Any help is appreciated!


    <?  
    //CHANNEL DETAILS
    $chan_title = "Crazyassthings.com"; 
    $chan_desc = "Free Movies - Watch Free Movies - Watch Movies Online - Free Movies Online - Download Movies";
    $chan_link = "http://www.crazyassthings.com/"; 
    
     
    //DATABASE CONNECTION
    $db_user = ''; 
    $db_pass = ''; 
    $db_host = ''; 
    $db_database = ''; 
    $db = mysql_connect($db_host, $db_user, $db_pass) or die(mysql_error());
    mysql_select_db($db_database); 
    
    //SELECT DATA 
    $query = "SELECT id, title, description, img FROM films ORDER BY id DESC LIMIT 10 ";
    $result = mysql_query($query) or die(mysql_error()); 
    if (mysql_num_rows($result) < 1) { 
        die("No records"); 
    } 
    
    //BUILD XML 
    $items = ''; 
    while ($row = mysql_fetch_assoc($result)) { 
        $item_link = $row["id"];
        $item_title = $row["title"];
        $item_description = $row["description"]; 
    	$img_url = $row["img"];
    	$views = $row["views"];
        $items .= <<<ITEM
    
            <item> 
    
    
                <title>Watch $item_title Free</title> 
                <link>http://www.crazyassthings.com/movie-preview.php?id=$item_link</link> 
                <description>$item_description</description> 
    
    
            </item> 
    
    ITEM;
    } 
    
    $content = <<<CONTENT
    <?xml version="1.0" encoding="UTF-8"?> 
    <rss version="2.0"> 
            <channel> 
                    <title>$chan_title</title> 
                    <link>$chan_link</link> 
                    <description>$chan_desc</description> 
                    
    $items
            </channel> 
    </rss> 
    
    CONTENT;
     
    header("Content-type: application/rss+xml"); 
    print $content;
     ?>
    PHP:
     
    scottlpool2003, Jun 1, 2010 IP