Dinamik sitemap yapmaya çalıştım. Bu hatayı aldım.




hatayı nerede yaptım bana dinamik sitemapta biri yardım edebilir mi lütfen ?



<?php
$servername = "localhost";
$username = "name";
$password = "pass";
$dbname = "dbname";
// bağlantı oluşturuyoruz
$conn = new mysqli($servername, $username, $password, $dbname);
$sql = "SELECT * FROM posts ORDER BY tarih DESC"; // Veritabanı sorgusu
$result = $conn->query($sql);
?>
<?php header('Content-type: application/xml; ',true); ?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">
<?php while($row = $result->fetch_assoc()) { ?>
<url>
<loc><?php echo 'https://www.xxxx.net/'.$row["xxx_name"]; ?></loc>
<!-- Veritabanı sütun adı -->
<changefreq>daily</changefreq>
<priority>0.7</priority>
</url>
<?php } ?>
</urlset>