Advertisement
Guest User

Untitled

a guest
Mar 31st, 2020
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. <select class="form-control">
  2. <?php
  3. include 'db.php';
  4.  
  5. // Create connection
  6. $conn = new mysqli($servername, $username, $password, $dbname);
  7. // Check connection
  8. if ($conn->connect_error) {
  9. die("Connection failed: " . $conn->connect_error);
  10. }
  11.  
  12. $sql = "SELECT * from stanowiska";
  13. $result = $conn->query($sql);
  14.  
  15. if ($result->num_rows > 0) {
  16. // output data of each row
  17. while($row = $result->fetch_assoc()) {
  18. echo '<option>'$row["nazwa"]'</option>';
  19. }
  20. } else {
  21. echo "0 results";
  22. }
  23. $conn->close();
  24. ?>
  25. </select>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement