-1

我需要一双全新的眼睛来查看我的 RSS 代码,因为它正在输出一个空白页面。但是,当我运行时,我会var_dump()收到输出。你能告诉我发生了什么吗?

 if($_GET['uid'] == ''){
    $usrid = $udata['user_name'];
}else{
    $usrid = $_GET['uid'];
}
    $udata = $userObj->fetchUser(array("user_name"=>$usrid));

$rssfeed = '<?xml version="1.0" encoding="utf-8"?>';
$rssfeed .= '<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">';
$rssfeed .= '<channel>';
$rssfeed .= '<title>Brags By '.$udata['full_name'].'</title>';
$rssfeed .= '<link>'.BASE_URL.'</link>';
$rssfeed .= '<description>'.SITE_TITLE2.'Be amazing. Get noticed.</description>';
$rssfeed .= '<language>en-us</language>';
$rssfeed .= '<copyright>Copyright (C) '.date("Y").' ' . SITE_TITLE2 . '</copyright>'; 

$dbSel = $db->dbh->prepare("SELECT *,UP.id as bragid FROM ".USERS_BRAG." as UP,".USERS." as U  where                   U.id = UP.user_id AND UP.status = :stat AND U.id= :uID ORDER BY UP.id DESC");    
$dbSel->execute(array(':stat'=>'1',':uID'=>$udata['id']));
$result=$dbSel->fetchAll(PDO::FETCH_ASSOC);
//
while($row = $result) {

    //echo var_dump($row);die;

    $img="<img src='".BASE_URL."public/bragimages/thumb/".$row['brag']."'>";
    $link=BASE_URL."bragdetails/".$row['bragid'];

    $rssfeed .= "<item>";
    $rssfeed .= "<title>".$row['brag_desc']."></title>";
    $rssfeed .= "<description>".$img."></description>";
    $rssfeed .= "<link>".$link."></link>";
    $rssfeed .= "<pubDate>".date("D, d M Y H:i:s O", strtotime($row['added_date']))."></pubDate>";
    $rssfeed .= "</item>";
}

$rssfeed .= '</channel>';
$rssfeed .= '</rss>';

echo $rssfeed;

谢谢您的帮助。

4

1 回答 1

1

改用 foreach

foreach ($result as $row) {
...
}
于 2013-01-15T16:20:20.110 回答