why my data wont get written to file?
Posted: Fri Feb 16, 2007 6:23 pm
Code: Select all
include ("../dbsetts.php");
include ("../globals.php");
if (!$xmlfile = fopen("../allpagesfeed.xml", "w")) {
echo "Cannot open file ($filename)";
exit;
}
fwrite($xmlfile,
"<rss version=\"2.0\">
<channel>
<title>".$siteTitle."</title>
<link>http://www.".$siteURL."</link>
<description>".$siteDescription."</description>
<pubDate>".date("D, d M Y H:i:s O")."</pubDate>
<generator>http://wordpress.org/?v=1.5.2</generator>
<language>en</language>
");
$rssconn=mysql_connect($dbhost, $dbuser, $dbpass);
mysql_select_db($dbname) or die ('Could not connect: ' . mysql_error());
// print "Connected to MySQL";
$rssquery="SELECT title,url,content FROM t_pages ORDER BY id DESC LIMIT 10";
//echo $query;
$rssqresult = mysql_query($rssquery) or die(mysql_error());
while ($rssline = mysql_fetch_object($rssqresult))
{
echo 'here1'; //<---makes it to here
fwrite($xmlfile,
"
<item>
<link>http://www.".$siteURL."/pagess/".$rssline['url']."</link>
<pubDate>".date('Y-m-d')."</pubDate>
<guid>http://www.".$siteURL."/pages/".$rssline["url"]."</guid>
<description>".$rssline['title']."</description>
<content>".$rssline['content']."</content>
</item>
"
);
echo 'here2'; //-<doesn't make it to here
}