Customer Name | Contact Name | Address | City | Postal Code | Country |
---|---|---|---|---|---|
Alfreds Futterkiste | Maria Anders | Obere Str. 57 | Berlin | 12209 | Germany |
Ana Trujillo Emparedados y helados | Ana Trujillo | Avda. de la ConstituciĆ³n 2222 | Mexico D.F. | 05021 | Mexico |
Antonio Moreno Taqueria | Antonio Moreno | Mataderos 2312 | Mexico D.F. | 05023 | Mexico |
Around the Horn | Thomas Hardy | 120 Hanover Sq. | London | WA1 1DP | UK |
Berglunds snabbkop | Christina Berglund | Berguvsvagen 8 | Lulea | S-958 22 | Sweden |
Here is the code for accessing the database and display the information in a table.
<table> <tr><th>Customer Name</th> <th>Contact Name</th> <th>Address</th> <th>City</th> <th>Postal Code</th> <th>Country</th></tr> <?php $q = intval($_GET['q']); $con = mysqli_connect('localhost','username','password'); if (!$con) { die('Could not connect: ' . mysqli_error($con)); } mysqli_select_db($con,"DBname"); $sql="SELECT * FROM Customers"; $result = mysqli_query($con,$sql); while($row = mysqli_fetch_array($result)) { echo "<tr style='background-color: rgba(255, 255, 0, 0.7);>"; echo "<td>" . $row["CustomerName"] . "</td>"; echo "<td>" . $row["ContactName"] . "</td>"; echo "<td>" . $row["Address"] . "</td>"; echo "<td>" . $row["City"] . "</td>"; echo "<td>" . $row["PostalCode"] . ">/td>"; echo "<td>" . $row[Country] . "</td>"; echo "</tr> } mysqli_close($con); ?> </table>