Advertisement
Guest User

eet

a guest
Jan 22nd, 2020
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. <?php
  2. $servername = "localhost";
  3. $username = "root";
  4. $password = "";
  5. $dbname = "sklep";
  6. $conn = new mysqli($servername, $username, $password, $dbname);
  7. if ($conn->connect_error) {
  8. die("Connection failed: " . $conn->connect_error);
  9. }
  10. $sql = "SELECT id, nazwa, opis, cena FROM podzespoly";
  11. $result = $conn->query($sql);
  12. if ($result->num_rows > 0) {
  13. while($row = $result->fetch_assoc()) {
  14. echo "<th>" . $row["id"]. "</th><th>" . $row["nazwa"]. "</th>
  15. <th>" . $row["opis"]. "</th><th>" . $row["cena"]. "</th></tr>" ;
  16. }
  17. } else {
  18. echo "0 results";
  19. }
  20. $conn->close();
  21. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement