Advertisement
Guest User

Untitled

a guest
Mar 5th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.56 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title> Aamir </title>
  5. <style type = "text/CSS">
  6. table{
  7. border-collapse: collapse;
  8. width: 60%;
  9. color: #d96459
  10. font-family: monospace;
  11. font-size: 20px;
  12. text-align: left;
  13. }
  14.  
  15. th{
  16. background-color: #d96459;
  17. color: white;
  18. }
  19.  
  20. tr:nth-child(even){
  21. background-color: #f2f2f2;
  22. }
  23.  
  24. h1{
  25. margin-bottom: -150px;
  26. }
  27. </style>
  28. </head>
  29. <body>
  30. <h1>Assignment 9</h1>
  31. <table>
  32. <tr>
  33. <th>Game Name</th>
  34. <th>Rating</th>
  35. <th>Company</th>
  36. <th>Price</th>
  37. <?php
  38. $servername = "localhost";
  39. $username = "ashaikh8";
  40. $password = "ashaikh8";
  41. $dbName = "ashaikh8";
  42.  
  43. // Create connection
  44. $conn = new mysqli($servername, $username, $password, $dbName);
  45.  
  46. // Check connection
  47. if ($conn->connect_error) {
  48. die("Connection failed: " . $conn->connect_error);
  49. }
  50.  
  51. $sql = "SELECT * from Assignment9";
  52. $result = $conn->query($sql);
  53. if ($result->num_rows > 0) {
  54. // output data of each row
  55. while($row = $result->fetch_assoc()) {
  56. echo
  57. "<tr><td>"
  58. . $row["GAME_NAME"]
  59. . "</td><td>"
  60. . $row["RATING"]
  61. . "</td><td>"
  62. . $row["COMPANY"]
  63. . "</td><td>"
  64. . $row["PRICE"]
  65. . "</td></tr>"
  66. . "<br>";
  67. }
  68. }
  69. else {
  70. echo "Something went wrong.";
  71. }
  72. $conn->close();
  73. ?>
  74. </table>
  75. </body>
  76. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement