Advertisement
Guest User

Untitled

a guest
Apr 17th, 2019
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. <?php
  2. $xml=false;
  3.  
  4. $servername = "localhost";
  5. $username = "root";
  6. $password = "";
  7. $dbname = "dolnoslaskie";
  8.  
  9. // Create connection
  10. $conn = new mysqli($servername, $username, $password, $dbname);
  11.  
  12. // Check connection
  13. if ($conn->connect_error) {
  14. die("Connection failed: " . $conn->connect_error);
  15. }
  16.  
  17. $xml=simplexml_load_file('calosc_Data_2019_01_dolnoslaskie.xml') or die("Error: Cannot create object");
  18. foreach($xml->children() as $infowpis)
  19. {
  20.  
  21. $sql1="insert into danepodstawowe values (null,'{$infowpis->DanePodstawowe->Imie}','{$infowpis->DanePodstawowe->Nazwisko}','{$infowpis->DanePodstawowe->NIP}','{$infowpis->DanePodstawowe->REGON}','{$infowpis->DanePodstawowe->Firma}','{$infowpis->IdentyfikatorWpisu}')";
  22. $conn->query($sql1);
  23.  
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement