SHARE
TWEET

Untitled

a guest May 23rd, 2018 86 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <!DOCTYPE html>
  2. <html lang="pl">
  3. <head>
  4. <meta charset="utf-8">
  5. <link rel="stylesheet" type="text/css" href="style.css">
  6. <title>TiTLe</title>
  7. </head>
  8. <body>
  9. <form action="tnjkp.php" method="GET">
  10. a:<input type="number" name="a"><br>
  11. b:<input type="number" name="b"><br>
  12. <input type="submit" value="wo">
  13. </form>
  14. <?php
  15. function suma($x, $y){
  16.     $s=$x+$y;
  17.     return $s;
  18. }
  19. if(isset($GET["a"]) && $_GET["a"]!="" &&_GET["b"]!=""){
  20.     //polaczenie z baza danych:
  21.     $serverName="localhost";
  22.     $userName="root";
  23.     $pass="";
  24.     $dbName="prostokat";
  25.  
  26. $conn=mysqli_connect($serverName,$userName,$pass,$dbName);
  27. if(!$conn) {
  28.     die("blad polaczenia".mysqli_connect_error());
  29. }    
  30.     $sql="insert into dane (a,b) values(".$_GET["a"].",".$_GET["b"].");";
  31.     $wynik=mysqli_query($conn,$sql);
  32.     if(!wynik){ die ("wynik zapytania blad");}
  33.     else{
  34.     $wynik=suma($_GET["a"],$_GET["b"]);
  35.     echo "<br> Wynik działania funkcji suma:".$wynik."<br>Zawartosc tabeli z bazy danych<br>";
  36.    
  37. }
  38.     mysqli_close($conn);
  39. }
  40. ?>
  41. </body>
  42. </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
 
Top