Advertisement
Guest User

Untitled

a guest
Dec 13th, 2018
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. <?php
  2.  
  3. $server = 'localhost';
  4. $user='root';
  5. $pass='';
  6. $db='cdkatalog';
  7. try {
  8. $con=new mysqli($server,$user,$pass,$db) or die("Greska!");
  9. } catch (Exception $exc) {
  10. echo $exc->getTraceAsString();
  11. }
  12. $sql='select * from cd';
  13. $rezultat = $con->query($sql);
  14. $xml = new DOMDocument('1.0');
  15. $xml->formatOutput = true;
  16. $catalog = $xml->createElement('CATALOG');
  17. $xml->appendChild($catalog);
  18.  
  19. while($row=$rezultat->fetch_assoc()){
  20. $cd = $xml->createElement('CD');
  21. $cd->setAttribute("id", row['id']);
  22. $catalog->appendChild($cd);
  23.  
  24. $title=$xml->createElement('TITLE');
  25. $cd->appendChild($title);
  26.  
  27. $artist
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement