0
<?php

  $dotaz=mysql_query("SELECT * FROM `Jazykove_kurzy`");

  $b="</kurz>\n";

if($dotaz) while($data = mysql_fetch_array($dotaz)) {

 $kod = "<kurz ID=\"$data[ID]\">         
    <jazyk>$data[jazyk]</jazyk>
    <pocet>$data[pocet]</pocet>
    <rozsah>$data[rozsah]</rozsah>
    <mesto>$data[mesto]</mesto>
    <cena>$data[cena]</cena>
    <lektori>$data[lektori]</lektori>
    <platnost>$data[platnost]</platnost>"; 

There is problem... when it write $b to $soubor, I have error

fwrite($soubor, $kod);
fwrite($soubor, $b);
}
fclose($soubor);

    ?>

I have no idea. Please help.

jh314
  • 27,144
  • 16
  • 62
  • 82
  • 1
    Please, [stop using `mysql_*` functions](http://stackoverflow.com/questions/12859942/why-shouldnt-i-use-mysql-functions-in-php). They are no longer maintained and are [officially deprecated](https://wiki.php.net/rfc/mysql_deprecation). Learn about [prepared statements](http://en.wikipedia.org/wiki/Prepared_statement) instead, and consider using PDO, [it's not as hard as you think](http://jayblanchard.net/demystifying_php_pdo.html). – Jay Blanchard May 18 '15 at 17:53
  • 1
    possible duplicate of ["XML Parsing Error: junk after document element"](http://stackoverflow.com/questions/15762857/xml-parsing-error-junk-after-document-element) – Jay Blanchard May 18 '15 at 17:54
  • Sorry i dont understand this. I have to see on code... – Karel Novis May 18 '15 at 19:31
  • 1
    Hi Karel, your PHP-code seems incomplete, I'd like to see the generated XML, too. The way you create the XML is unsafe and vulnerable to errors, so use a parser like `SimpleXML` or `DOM instead`. – michi May 18 '15 at 20:46

0 Answers0