Jump to content

while loop not showing anything


nicky666
Go to solution Solved by Ch0cu3r,

Recommended Posts

Hi i'm trying to create a rss page, the problem I have is that the data is not showing. If I check the page source the data is there but it's not showing up and I can't seem to figure out why or how to fix it.

<?php
ini_set('display_errors', 1);
header("Content-type: text/xml");
include("includes/database.php");
global $NEWS;
$str = '<?xml version="1.0" encoding="UTF-8"?>';
$str.= '<rss version="2.0">';
$str.='<channel>';
$sql = "SELECT * FROM news";

$result = mysql_query($sql) or die ($sql."".mysql_error());

while($row = mysql_fetch_object($result)){
    $str.= '<item>';
    $str.= '<title>'.$row->title.'</title>';
    $str.= '<description>'.$row->content. '</description>';
    $str.= '</item>';
}

$str .='</channel>';
$str .='</rss>';
echo $str;
Link to comment
Share on other sites

I validated the feed and I got this

 

 

This feed does not validate.

  • line 1, column 113: Undefined description element: p [help]

    ... title>xzfbcbcxv 123</title><description><p>Mr. Kim Keats-Martínez, Execu ...                                             ^

  • line 1, column 116: XML parsing error: <unknown>:1:402: not well-formed (invalid token) [help]

    ... le>xzfbcbcxv 123</title><description><p>Mr. Kim Keats-Martínez, Executiv ...

I'm not sure how I'm going to fix this as the cms I'm using puts the <p> tag automatically

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.