<?php
$servername = "localhost";
$username = "xx";
$password = "xx";
$dbname = "xx";
$conn = new mysqli($servername, $username, $password, $dbname);
$sql = "SELECT * FROM aa_link";
$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><![CDATA[<?php echo 'https://aa.com'.$row["aa_link"]; ?>]]></loc>
<changefreq>weekly</changefreq>
<priority>0.7</priority>
</url>
<?php } ?>
</urlset>