Advertisement
Guest User

Untitled

a guest
Jan 19th, 2018
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.27 KB | None | 0 0
  1. <?php
  2.  
  3.     $servername = "localhost";
  4.     $username = "admin";
  5.     $password = "admin";
  6.     $dbname = "aufgabe02";
  7.  
  8.     function Refresh()
  9.     {
  10.         $con = new mysqli("localhost", "admin", "admin", "aufgabe02");
  11.         $con = new mysqli($servername, $username, $password, $dbname);
  12.  
  13.         if(!$con)
  14.         {
  15.             die("Connection Problem: ". $con->connect_error);
  16.         }
  17.  
  18.         $sql = "SELECT * FROM aufgabe02.employee";
  19.         $result = $con->query($sql);
  20.         if(!$result)
  21.         {
  22.             echo "Error: ". $con->error;
  23.         }
  24.         if ($result->num_rows > 0)
  25.         {
  26.             while ($row = $result->fetch_assoc())
  27.             {
  28.                 $option = $row["id"] . " " . $row["forename"] . " " . $row["name"] . " " . $row["city"];
  29.                 echo "<option>" . $option . "</option>";
  30.             }
  31.         }
  32.         else{
  33.             echo "<option>LEER</option>";
  34.         }
  35.  
  36.         $con->close();
  37.     }
  38.  
  39.     function AddUser($id, $forename, $name, $city)
  40.     {
  41.         global $con;
  42.  
  43.         if($con->connect_error)
  44.         {
  45.             die("Connection Problem: ". $con->connect_error);
  46.         }
  47.  
  48.         echo $forename;
  49.     }
  50.  
  51.     if(isset($_POST['sent']))
  52.     {
  53.         echo "moin";
  54.     }
  55.  
  56. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement