My Customers

Customer NameContact NameAddressCityPostal CodeCountry
Alfreds FutterkisteMaria AndersObere Str. 57Berlin12209Germany
Ana Trujillo Emparedados y heladosAna TrujilloAvda. de la ConstituciĆ³n 2222Mexico D.F.05021Mexico
Antonio Moreno TaqueriaAntonio MorenoMataderos 2312Mexico D.F.05023Mexico
Around the HornThomas Hardy120 Hanover Sq.LondonWA1 1DPUK
Berglunds snabbkopChristina BerglundBerguvsvagen 8LuleaS-958 22Sweden

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>