1

I m trying to create sitemap for my php script my code is:

$base_url = "https://www.mywebsite.com/index.php?a=browse&b=category&id=";

header("Content-Type: application/xml; charset=utf-8");

echo '<?xml version="1.0" encoding="UTF-8"?>'.PHP_EOL; 

echo '<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_EOL;

while($row = mysqli_fetch_array($result))
{
 echo '<url>' . PHP_EOL;
 echo '<loc>'.$base_url. $row['category_id'] .'</loc>' . PHP_EOL;
 echo '<changefreq>daily</changefreq>' . PHP_EOL;
 echo '</url>' . PHP_EOL;
}

I'm getting this error :

error

Nigel Ren
  • 56,122
  • 11
  • 43
  • 55

1 Answers1

0

Thank you! Nigel Ren..

I have only Replaced this line and it worked:

$base_url = "https://www.mywebsite.com/index.php?a=browse&b=category&id=";

to

$base_url = "https://www.mywebsite.com/index.php?a=browse&amp;b=category&amp;id=";