Advertisement
Guest User

Untitled

a guest
Aug 3rd, 2016
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.36 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title>WebTest</title>
  6. <style type="text/css">
  7.  
  8. </style>
  9. </head>
  10. <body>
  11. <form action="test.php" method="POST">
  12.  
  13. <label>
  14. Registracijas numurs<input type="text" name="Registracijas_numurs" value="">
  15. </label></br>
  16. <label>
  17. Izlaiduma gads<input type="text" name="Izlaiduma_gads" value="">
  18. </label></br>
  19. <!-- <label>
  20. Marka<input type="text" name="Marka" value="">
  21. </label></br>
  22. <label>
  23. Motora tips<input type="text" name="Motora_tips" value="">
  24. </label></br> -->
  25. <label>
  26. Motora tilpums<input type="text" name="Motora_tilpums" value="">
  27. </label></br>
  28. <label>
  29. Pilna masa<input type="text" name="Pilna_masa" value="">
  30. </label></br>
  31. <label>
  32. Pasmasa<input type="text" name="Pasmasa" value="">
  33. </label></br>
  34. <!-- <label>
  35. Piedzinas tips<input type="text" name="Piedzinas_tips" value="">
  36. </label> -->
  37. <input type="submit" value="Ievadit">
  38. </form>
  39.  
  40. <?php
  41. $db_hostname = "localhost";
  42. $db_database = "prak";
  43. $db_username = "root";
  44. $db_password = "123";
  45.  
  46. $conn = mysqli_connect($db_hostname, $db_username, $db_password, $db_database);
  47. if ($conn -> connect_error) {
  48. die ("Connection failed" . $conn -> connect_error);
  49. }
  50. echo "<h3>Connected</h3>" . "<br>";
  51.  
  52. //Display table data
  53. $sql = "SELECT AUTONR, AUTOGADS,
  54. MOTORATILPUMS, PILNAMASA, PASMASA, NOSAUKUMS FROM auto, marka";
  55. $result = mysqli_query($conn, $sql);
  56. echo "<table border=1>
  57. <tr>
  58. <th>Reģistrācijas numurs</th>
  59. <th>Izlaidumagads</th>
  60. <th>Marka</th>
  61. <th>Motora tips</th>
  62. <th>Motora tilpums</th>
  63. <th>Pilnā masa(kg)</th>
  64. <th>Pašmasa(kg)</th>
  65. <th>Piedziņas tips</th>";
  66. if ($result = mysqli_query($conn, $sql)) {
  67. while ($row = mysqli_fetch_row($result)) {
  68. echo "<tr>";
  69. echo "<td>" . $row['0'] . "</td>";
  70. echo "<td>" . $row['1'] . "</td>";
  71. echo "<td>" . $row['5'] . "</td>";
  72. echo "<td>" . "-" . "</td>";
  73. echo "<td>" . $row['2'] . "</td>";
  74. echo "<td>" . $row['3'] . "</td>";
  75. echo "<td>" . $row['4'] . "</td>";
  76. echo "<td>" . "-" . "</td>";
  77. echo "</tr>";
  78. }
  79. }
  80. echo "</table>";
  81.  
  82. //close connection
  83. mysqli_close($conn);
  84. ?>
  85.  
  86. </body>
  87. <html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement