Guest User

Untitled

a guest
Feb 24th, 2016
30
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.26 KB | None | 0 0
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  5. <title>Games Library Home Page</title>
  6. <link href="styles.css" rel="stylesheet" type="text/css">
  7. </head>
  8.  
  9. <body>
  10. <?php
  11. //getting the data from the csv
  12. $count = 0;
  13. $file = fopen("games.csv","r");
  14. while (($games[] = fgetcsv($file)) !== FALSE) {
  15. //$metals is an array of the csv elements
  16. $count = $count + 1;
  17.  
  18. }
  19. fclose($file);
  20.  
  21. ?>
  22. <div id='main'>
  23. <div id='titleImage'><img title='Home' src='images/GLLogo.png' width='700' height='190' alt='Games Library Title' /></div>
  24. <div id='menu-wrapper'>
  25. <div id='menu'>
  26. <ul>
  27. <li class='current_page_item'><a href='#'>Home</a></li>
  28. <li><a href='reservations.php'>Reservations</a></li>
  29. </ul>
  30. </div>
  31. </div>
  32.  
  33. <div id='tables'>
  34. <?php
  35. $servername = "localhost";
  36. $username = "awilkinson1";
  37. $password = "ebscs";
  38. $dbname = "awilkinson";
  39. //create connection
  40. $conn = new mysqli($servername, $username, $password, $dbname);
  41.  
  42. //check connection
  43. if($conn->connect_Error) {//if stop loading html and display error
  44. die("Connection failed: ". $conn->connect_error);
  45. }
  46. echo "...Connected successfully...<br><br>";
  47. $sql = "SELECT GameName, GameDescription FROM Games1 WHERE GameName='Fantasy World'"
  48. ?>
  49. <h1>Games </h1>
  50. <table>
  51. <tr>
  52. <th bgcolor="#FF0000">Game ID</th>
  53. <th bgcolor="#FF0000">Genre</th>
  54. <th bgcolor="#FF0000">Game Name</th>
  55. <th bgcolor="#FF0000">Game Description</th>
  56. <th bgcolor="#FF0000">Rental Cost per day</th>
  57. </tr>
  58. <?php
  59. $numberofrows = $count - 1;
  60. $numberofcolums = 4;
  61.  
  62. for($row = 0; $row <= $numberofrows; $row++){
  63. echo "<tr>";
  64. for($col = 0; $col <= $numberofcolums; $col++){
  65. if ($col == 4){
  66. echo "<td> £".$games[$row][$col]."</td>";
  67.  
  68. }else{
  69. echo "<td>".$games[$row][$col]."</td>";
  70. }
  71.  
  72.  
  73.  
  74. }
  75. echo "</tr>";
  76. }
  77.  
  78.  
  79. ?>
  80.  
  81.  
  82. </table>
  83.  
  84.  
  85. </div>
  86. </div>
  87.  
  88. </body>
  89. </html>
Add Comment
Please, Sign In to add comment