Advertisement
Guest User

Untitled

a guest
Dec 7th, 2016
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.27 KB | None | 0 0
  1. <!Doctype Html>
  2. <html>
  3. <head>
  4.  
  5. <title>Strona</title>
  6.  
  7. <meta charset="UTF-8"/>
  8. <link rel="stylesheet" type="text/css" href="wzrs.css">
  9.  
  10.  
  11. </head>
  12. <body>
  13. <div id="banner">
  14. <p>wypozyczalnia</p>
  15.  
  16. </div>
  17. <div id="lewy">
  18. <center><p><a href="index.php">MENU</a></p></center>
  19.  
  20. <ol type="a">
  21. <li><a href="klienci.php">Klienci</a><br></li>
  22. <li><a href="filmy.php">Filmy</a></li>
  23. <li><a href="wypozyczenia.php">wypozyczenia</a></li>
  24. </ol>
  25.  
  26.  
  27.  
  28.  
  29. </div>
  30.  
  31. <div id="center">
  32. <?
  33. error_reporting(E_ALL ^ E_NOTICE);
  34. ?>
  35. <?php
  36.  
  37. $tab = file('klienci.txt');
  38. $n = count($tab);
  39. $rekordy='';
  40. for ($i = 0; $i < $n; $i++) {
  41. $l = explode("\t", $tab[$i]);
  42. $rekordy.="(".trim($l[0]).",'".trim($l[1])."','".trim($l[2])."')";
  43. if($i<$n-1) $rekordy.=",";
  44. }
  45. $rekordy.=";";
  46.  
  47.  
  48.  
  49.  
  50. $servername='localhost';
  51. $login='root';
  52. $password='';
  53. $db='vod';
  54.  
  55.  
  56. $conn=mysqli_connect($servername,$login,$password,$db);
  57. if($conn){
  58.  
  59. echo "polaczono z baza danych <br>";
  60.  
  61.  
  62. }
  63. else
  64. {
  65.  
  66. die("blad polaczenia".mysqli_connect_error ());
  67.  
  68.  
  69. }
  70.  
  71. $sql="INSERT into klienci (Pesel, Imie, Nazwisko) VALUES ".$rekordy;
  72. mysqli_multi_query($conn, $sql);
  73.  
  74.  
  75.  
  76.  
  77.  
  78.  
  79.  
  80.  
  81. ?>
  82.  
  83.  
  84.  
  85.  
  86.  
  87. </div>
  88.  
  89. <div id="down">
  90. <center><p> </p></center>
  91. </div>
  92.  
  93.  
  94.  
  95.  
  96. </body>
  97.  
  98.  
  99.  
  100. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement