Guest User

Untitled

a guest
Apr 7th, 2017
28
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.08 KB | None | 0 0
  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7. <!DOCTYPE html>
  8. <html>
  9. <head>
  10. </head>
  11. <body>
  12. <form action="insertData.php" method="post">
  13. artist: <input type="varchar" name="artist" method="post"><br>
  14. title: <input type="varchar" name="title"method="post"><br>
  15. category: <input type="varchar" name="category"method="post"><br>
  16. played: <input type="int" name="played"method="post"><br>
  17. tracks: <input type="int" name="tracks"method="post"><br>
  18. reldate: <input type="date" name="reldate"method="post"><br>
  19. <input type="submit" value="Insert">
  20. </form>
  21.  
  22. <form action="deleteData.php" method="post">
  23. id: <input type="int" name="id"><br>
  24. <input type="submit" value="Delete">
  25. </form>
  26.  
  27. <form action="updateData.php" method="post">
  28. id: <input type="int" name="id"><br>
  29. artist: <input type="varchar" name="artist" ><br>
  30. title: <input type="varchar" name="title"><br>
  31. category: <input type="varchar" name="category"><br>
  32. played: <input type="int" name="played"><br>
  33. tracks: <input type="int" name="tracks"><br>
  34. reldate: <input type="date" name="reldate"><br>
  35. <input type="submit" value="Update">
  36. </form>
  37.  
  38. <?php
  39. $servername = "localhost";
  40. $username = "root";
  41. $password = "";
  42. $dbname = "cs230";
  43.  
  44.  
  45. // Create connection
  46. $conn = mysqli_connect($servername, $username, $password, $dbname);
  47. // Check connection
  48. if (!$conn) {
  49. die("Connection failed: " . mysqli_connect_error());
  50. }
  51.  
  52. $sql = "SELECT artist,id ,title, category, played, tracks, reldate FROM cdset";
  53. $result = $conn->query($sql);
  54. echo '<table border=1 cellpadding=1 width ="90%">';
  55.  
  56. echo "<td style='border:1px solid black;Font-size:18;Font-Weight:bold;text-align:center'>";
  57. echo "artist";
  58. echo "</td>";
  59. echo "<td style='border:1px solid black;Font-size:18;Font-Weight:bold;text-align:center'>";
  60. echo "id";
  61. echo "</td>";
  62. echo "<td style='border:1px solid black;Font-size:18;Font-Weight:bold;text-align:center'>";
  63. echo "title";
  64. echo "</td>";
  65. echo "<td style='border:1px solid black;Font-size:18;Font-Weight:bold;text-align:center'>";
  66. echo "category";
  67. echo "<td style='border:1px solid black;Font-size:18;Font-Weight:bold;text-align:center'>";
  68. echo "played";
  69. echo "<td style='border:1px solid black;Font-size:18;Font-Weight:bold;text-align:center'>";
  70. echo "tracks";
  71. echo "<td style='border:1px solid black;Font-size:18;Font-Weight:bold;text-align:center'>";
  72. echo "reldate";
  73. echo "</td>";
  74.  
  75. if($result->num_rows > 0) {
  76. // output data of each row
  77. while($row = $result->fetch_assoc()) {
  78. echo '<tr class = "t_row">';
  79. echo '<td>' .$row['artist']. '</td>';
  80. echo '<td>' .$row['id']. '</td>';
  81. echo '<td>' .$row['title']. '</td>';
  82. echo '<td>' .$row['category']. '</td>';
  83. echo '<td>' .$row['played']. '</td>';
  84. echo '<td>' .$row['tracks']. '</td>';
  85. echo '<td>' .$row['reldate']. '</td>';
  86. }
  87.  
  88. echo '</table>';
  89.  
  90. }else {
  91. echo "0 results";
  92. }
  93. $conn->close();
  94. ?>
  95. </body>
  96. </html>
Add Comment
Please, Sign In to add comment