Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE HTML>
- <html>
- <head>
- <meta charset = "utf-8"/>
- <title>Northwind Database - itins3</title>
- </head>
- <body>
- <h1>Northwind Database - Orders Table</h1>
- <hr/>
- <?php
- // Connect to itins3 database
- // use your username as the second parameter instead of crice
- // use your password, instead of the constant DB_PASSWORD, it will be something like
- // 's1234567'
- $databaseConnection = mysqli_connect('itins3.madisoncollege.edu', 'skatz', 's2813455', 'Northwind');
- // server addressm, username, password, database name
- // Test the database connection
- if (!$databaseConnection)
- {
- exit("Connection failed. " . $databaseConnection);
- }
- ?>
- <h2>Orders</h2>
- <table border = '1'>
- <tr>
- <th>Order ID</th>
- <th>Customer ID</th>
- <th>Employee ID</th>
- <th>Order Date</th>
- <th>Ship Name</th>
- <th>Ship Via</th>
- <th>Freight</th>
- </tr>
- <?php
- // Create SQL Statement
- $sqlQuery = "SELECT * FROM Orders ORDER BY EmployeeID";
- $resultSet = mysqli_query($databaseConnection, $sqlQuery);
- if (!$resultSet)
- {
- exit ("SQL Statement Error: " . $sqlQuery);
- }
- while ($row = mysqli_fetch_array($resultSet))
- {
- echo "<tr>";
- echo "<td>" . $row['OrderID'] . "</td>";
- echo "<td>" . $row['CustomerID'] . "</td>";
- echo "<td>" . $row['EmployeeID'] . "</td>";
- echo "<td>" . $row['OrderDate'] . "</td>";
- echo "<td>" . $row['ShipName'] . "</td>";
- echo "<td>" . $row['ShipVia'] . "</td>";
- echo "<td>" . $row['Freight'] . "</td>";
- echo "</tr>";
- }
- mysqli_close($databaseConnection);
- ?>
- </table>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement