Advertisement
Guest User

Untitled

a guest
Mar 27th, 2017
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <body>
  4.  
  5. <?php
  6. $servername = "localhost";
  7. $username = "root";
  8. $password = "";
  9. $dbname = "iskolai";
  10.  
  11. // Create connection
  12. $conn = mysqli_connect($servername, $username, $password, $dbname);
  13.  
  14. // Check connection
  15. if (!$conn) {
  16. die("Kapcsolódási hiba: " . mysqli_connect_error());
  17. }
  18.  
  19. $sql = "SELECT * FROM ital";
  20.  
  21. $result = mysqli_query($conn, $sql);
  22.  
  23. if (mysqli_num_rows($result) > 0) {
  24. // output data of each row
  25. echo "<table border='10'>";
  26. echo "<tr>";
  27. echo "<th>";
  28. echo "Nev";
  29. echo "</th>";
  30. echo "<th>";
  31. echo "Mennyiseg";
  32. echo "</th>";
  33. echo "<th>";
  34. echo "Ar";
  35. echo "</th>";
  36. echo "<tr>";
  37. while($row = mysqli_fetch_assoc($result)) {
  38.  
  39.  
  40. echo "<tr>";
  41. echo "<td>" . $row["ital_nev"] . "</td>";
  42. echo "<td>" . $row["ital_mennyiseg"] . "</td>";
  43. echo "<td>" . $row["ital_ar"] . "</td>";
  44. echo "<tr>";
  45.  
  46. }
  47. echo "</table>";
  48. } else {
  49. echo "RIP";
  50. }
  51.  
  52. mysqli_close($conn);
  53. ?>
  54.  
  55. </body>
  56. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement