daily pastebin goal
28%
SHARE
TWEET

Untitled

a guest Jan 17th, 2019 86 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. $db = mysqli_connect("localhost", "root", "", "ogloszenia");
  3. ?>
  4.  
  5.  
  6. <form>
  7.     <select name="user">
  8.         <option disabled value="" selected>Wybierz uzytkownika</option>
  9.  
  10. <?php
  11. $query = "SELECT * FROM uzytkownik";
  12. $users = mysqli_query($db, $query);
  13.  
  14. while($row = mysqli_fetch_array($users)) {
  15.     echo '<option value="'.$row["id"].'">'.$row["imie"].' '.$row["nazwisko"].'</option>';
  16. }
  17. ?>
  18.    
  19. </select>
  20. <input type="submit"></form>
  21.  
  22.  
  23. <?php
  24. if (isset($_GET["user"]) && $_GET["user"]) {
  25.     $userId = $_GET["user"];
  26.     $query = "SELECT * FROM ogloszenie WHERE uzytkownik_id = ".$userId;
  27.     $dane = mysqli_query($db, $query);
  28.     while($row = mysqli_fetch_array($dane)) {
  29.         echo $row["tytul"]."<br>";
  30.     }
  31. }
  32.     mysqli_close($db);
  33. ?>
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