0

im trying to make a dynamic sitemap with php but when i use "&" as a string in my while loop im getting error: "error on line 1 at column 506: EntityRef: expecting ';'" if i delete "&" code works this is the while loop:

while ($category = mysqli_fetch_array($categories)) {
echo "<url><loc>http://" . $_SERVER['HTTP_HOST'] . "/anime-detail?anime_sef=".$category['anime_sef']."&id=".$category['anime_id']."</loc></url>"; }
SorryBaby
  • 7
  • 3
  • 1
    & you can use this – Taariq Solomons Mar 17 '21 at 13:35
  • did you try single quotes? `'http://' . $_SERVER['HTTP_HOST'] . '/anime-detail?anime_sef='.$category['anime_sef'].'&id='.$category['anime_id'].'';` Strings in double quotes are interpreted, in single are not. – biesior Mar 17 '21 at 13:35
  • It's unclear what has given you this error, but the problem seems to be XSS. Please always encode values properly – Dharman Mar 17 '21 at 13:37

0 Answers0