Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <title> Aamir </title>
- <style type = "text/CSS">
- table{
- border-collapse: collapse;
- width: 60%;
- color: #d96459
- font-family: monospace;
- font-size: 20px;
- text-align: left;
- }
- th{
- background-color: #d96459;
- color: white;
- }
- tr:nth-child(even){
- background-color: #f2f2f2;
- }
- h1{
- margin-bottom: -150px;
- }
- </style>
- </head>
- <body>
- <h1>Assignment 9</h1>
- <table>
- <tr>
- <th>Game Name</th>
- <th>Rating</th>
- <th>Company</th>
- <th>Price</th>
- <?php
- $servername = "localhost";
- $username = "ashaikh8";
- $password = "ashaikh8";
- $dbName = "ashaikh8";
- // Create connection
- $conn = new mysqli($servername, $username, $password, $dbName);
- // Check connection
- if ($conn->connect_error) {
- die("Connection failed: " . $conn->connect_error);
- }
- $sql = "SELECT * from Assignment9";
- $result = $conn->query($sql);
- if ($result->num_rows > 0) {
- // output data of each row
- while($row = $result->fetch_assoc()) {
- echo
- "<tr><td>"
- . $row["GAME_NAME"]
- . "</td><td>"
- . $row["RATING"]
- . "</td><td>"
- . $row["COMPANY"]
- . "</td><td>"
- . $row["PRICE"]
- . "</td></tr>"
- . "<br>";
- }
- }
- else {
- echo "Something went wrong.";
- }
- $conn->close();
- ?>
- </table>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement