SHARE
TWEET

Untitled

a guest Dec 12th, 2019 118 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. setcookie('jajko',++$_COOKIE['jajko'],time()+2137);
  3. ?>
  4. <html>
  5. <head>
  6. <meta charset="UTF-8">
  7. <title>Łączenie z BD</title>
  8. </head>
  9. <body>
  10.  
  11. <form action="#" method="GET">
  12. Podaj ID <input type="text" name="wr3"><br/>
  13. Podaj Markę <input type="text" name="wr1"><br/>
  14. Podaj Model <input type="text" name="wr2"><br/>
  15. <input type="submit" value="Podaj" name="wyslij">
  16. </form>
  17.  
  18.  
  19. <?php
  20. @$w1=$_GET["wr1"];
  21. @$w2=$_GET["wr2"];
  22. @$w3=$_GET["wr3"];
  23. print "Liczba odwiedzeń: ".$_COOKIE['jajko'];
  24.  
  25. session_start();
  26. if(!isset($_SESSION['pomidorek']))
  27. {
  28.     $_SESSION['pomidorek']=0;
  29. }
  30. $_SESSION['pomidorek']++;
  31. echo "<br/>";
  32. echo "Liczba odwiedzeń sesji: ".$_SESSION['pomidorek'];
  33. ?>
  34. <?php
  35.     echo "<h2>Wykaz Samochodów</h2>";
  36.     $host="localhost";
  37.     $user="root";
  38.     $password="";
  39.     $dbname="komis";
  40.  
  41.     $polaczenie=mysqli_connect($host,$user,$password,$dbname);
  42.     $sql="SELECT id,marka,model FROM samochody";
  43.  
  44.     $dodawanie="INSERT into samochody (id,marka,model) VALUES ('NULL','$w1','$w2')";
  45.     $dodane=mysqli_query($polaczenie,$dodawanie);
  46.  
  47.     $wynik=mysqli_query($polaczenie,$sql);
  48.     while($wiersz=mysqli_fetch_assoc($wynik))
  49.     {
  50.         echo('<li>'.$wiersz['id'].' '.$wiersz['marka'].' '.$wiersz['model'].'</li>'."<br/>");
  51.     }
  52.  
  53. ?>
  54. <table border width="300" align="center" cellspacing="0" cellpadding="10">
  55. <?php
  56.     $host="localhost";
  57.     $user="root";
  58.     $password="";
  59.     $dbname="komis";
  60.  
  61.     $polaczenie=mysqli_connect($host,$user,$password,$dbname);
  62.     $sql="SELECT id,marka,model FROM samochody";
  63.     $wynik=mysqli_query($polaczenie,$sql);
  64.  
  65.     while($wiersz=mysqli_fetch_assoc($wynik))
  66.     {
  67.         echo "<tr>";
  68.         echo "<td>".$wiersz['id']."</td>";
  69.         echo "<td>".$wiersz['marka']."</td>";
  70.         echo "<td>".$wiersz['model']."</td>";
  71.         echo "</tr>";
  72.  
  73.     }
  74.     mysqli_close($polaczenie);
  75. ?>
  76. </table>
  77. </body>
  78. </html>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top