0

Im trying to generate an xml with the code below, but I get this error message

without the POST, the xml is created normally.

require("conexao.php");


$variable = $_POST['cat1'];


$result_markers = "SELECT * FROM results where `cat` LIKE ' 
$variable'";
$resultado_markers = mysqli_query($link, $result_markers);

header("Content-type: text/xml");

echo '<markers>';

while ($row_markers = @mysqli_fetch_assoc($resultado_markers)){
  echo '<marker ';
  echo 'id="' . $row_markers['id'] . '" ';
  echo 'name="' . parseToXML($row_markers['name']) . '" ';
  echo '/>';
}

echo '</markers>';
Carlos Robles
  • 10,828
  • 3
  • 41
  • 60
  • 2
    I'll say the same thing I said on that question (can't find it right now). You're suppressing errors by doing `@mysqli_fetch_assoc()`. Errors are given for a reason. Don't ignore them. Chances are, you're generating errors that would give you a good idea what's wrong. – Patrick Q May 10 '18 at 17:18
  • 100% agree with above comment. Possibly related to your issue - https://stackoverflow.com/questions/8850120/extra-content-at-the-end-of-the-document-php-and-xml?answertab=votes#tab-top – waterloomatt May 10 '18 at 17:43
  • 1
    You possibly have an injection error: `"SELECT * FROM results where \`cat\` LIKE '$variable'"`. Bind parameters, don't inject variables. Possibly whatever is sending the post variable is not sending what you expect. There are a couple unknowns here. – Rasclatt May 10 '18 at 19:43

0 Answers0