Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <title>Games Library Home Page</title>
- <link href="styles.css" rel="stylesheet" type="text/css">
- </head>
- <body>
- <?php
- //getting the data from the csv
- $count = 0;
- $file = fopen("games.csv","r");
- while (($games[] = fgetcsv($file)) !== FALSE) {
- //$metals is an array of the csv elements
- $count = $count + 1;
- }
- fclose($file);
- ?>
- <div id='main'>
- <div id='titleImage'><img title='Home' src='images/GLLogo.png' width='700' height='190' alt='Games Library Title' /></div>
- <div id='menu-wrapper'>
- <div id='menu'>
- <ul>
- <li class='current_page_item'><a href='#'>Home</a></li>
- <li><a href='reservations.php'>Reservations</a></li>
- </ul>
- </div>
- </div>
- <div id='tables'>
- <?php
- $servername = "localhost";
- $username = "awilkinson1";
- $password = "ebscs";
- $dbname = "awilkinson";
- //create connection
- $conn = new mysqli($servername, $username, $password, $dbname);
- //check connection
- if($conn->connect_Error) {//if stop loading html and display error
- die("Connection failed: ". $conn->connect_error);
- }
- echo "...Connected successfully...<br><br>";
- $sql = "SELECT GameName, GameDescription FROM Games1 WHERE GameName='Fantasy World'"
- ?>
- <h1>Games </h1>
- <table>
- <tr>
- <th bgcolor="#FF0000">Game ID</th>
- <th bgcolor="#FF0000">Genre</th>
- <th bgcolor="#FF0000">Game Name</th>
- <th bgcolor="#FF0000">Game Description</th>
- <th bgcolor="#FF0000">Rental Cost per day</th>
- </tr>
- <?php
- $numberofrows = $count - 1;
- $numberofcolums = 4;
- for($row = 0; $row <= $numberofrows; $row++){
- echo "<tr>";
- for($col = 0; $col <= $numberofcolums; $col++){
- if ($col == 4){
- echo "<td> £".$games[$row][$col]."</td>";
- }else{
- echo "<td>".$games[$row][$col]."</td>";
- }
- }
- echo "</tr>";
- }
- ?>
- </table>
- </div>
- </div>
- </body>
- </html>
Add Comment
Please, Sign In to add comment