You are here: Help with fopen « All PHP « IT news, forums, messages
Help with fopen

Posted by hotortillas on 09/28/68 11:45

I got the following code but it doesnt write anything in to the
mexautosrss.file, anyone can see where is my problem?

<?PHP
function createRSS() {
$currentDate = time();
$sql = "SELECT * FROM ADS_TABLE WHERE expires > $currentDate ORDER BY
pkAdId DESC'";
$results = mysql_query($sql) or die ("Get Ads Query Failed: " .
mysql_error());
// open a file pointer to an RSS file
$fp = fopen ("/home2/mexauto/public_html/mexautosrss.xml", "w");
// Now write the header information
fwrite ($fp, "<?xml version='1.0' ?><rss version='2.0'><channel>");
fwrite ($fp, "<title>MexAutos.com</title>");
fwrite ($fp, "<link>http://www.mexautos.com/</link>");
fwrite ($fp, "<description>Es un sitio en internet dedicado a los
anuncios de venta de vehiculos: autos, camionetas, lanchas, motos y
aviones.</.</description>");
fwrite ($fp, "<language>en-us</language>");
fwrite ($fp, "<docs>http://www.mexautos.com/mexautosrss.xml</docs>");
fwrite ($fp, "<image>");
fwrite ($fp, " <title>MexAutos.Com</title>");
fwrite ($fp, "
<url>http://www.mexautos.com/images/logo_top.gif</url>");
fwrite ($fp, " <link>http://www.mexautos.com</link>");
fwrite ($fp, "</image>");
while ($row = mysql_fetch_row($results)) {
$title = $row['make']." ".$row['make_other']." ".$row['model']."
".$row['model_other']." ".$row['model_year'];
$content = $row['price']." ".$row['color']." ".$row['clima']."
".$row['milage']." ".$row['doors']." ".$row['transmission']."
".$row['comment']." ".$row['telnum']." (".$state.")";
fwrite ($fp, "<item>");
fwrite ($fp, " <title>$title</title>");
fwrite ($fp, " <description>$content</description>");
fwrite ($fp, " <link>http://www.mexautos.com/index.php</link>");
fwrite ($fp, "</item>");
}
fwrite ($fp, "</channel></rss>");
fclose ($fp);
}
?>

It is in functions.inc so it is already connected to the db.

Regards,
Carlos

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация