When I run this script I made, it produces all the data (URLs, last modified date, etc) but it does not look like a standard XML feed. Is there something I’ve overlooked? I want to make a dynamic Sitemap so that Google always has the full list of all my dynamic content.
Thanks!!
<?php
include 'db.inc.php';
print ("<?xml version=\\"1.0\\" encoding=\\"UTF-8\\"?>");
print ("<urlset xmlns=\\"http://www.sitemaps.org/schemas/sitemap/0.9\\">");
$getTestimonials = "SELECT tID, date from testimonies where approved ='Yes' order by date desc limit 15";
$result = mysql_query ($getTestimonials) OR die(mysql_error());
if ($row = mysql_fetch_array($result)) {
print ("<urlset>\
");
do {
$tID = $row["tID"];
$date = $row["date"];
$date = date("D, d M Y H:i:s \\G\\M\\T");
print ("\
\
<url>\
");
print ("<loc>http://www.oil-testimonials.com/essential-oils/$tID</loc>\
");
print ("<lastmod>$date</lastmod>\
");
print ("<changefreq>yearly</changefreq>\
");
print ("</url>\
");
} while($row = mysql_fetch_array($result));
print ("</urlset>\
");
} else {print "Sorry, no testimonials were found!";}
?>