I'm back again with another, probably simple question. Why exactly is this not working? It connects to the dBase, the html table shows, but no data is showing. It's only displaying $row in each cell and some info about the if statement. I've attempted a few different variations, and in the end, every method I have attempted to utilize to pull information from the dBase has resulted in the same problem. It looked simple enough to me, but here were are.
<!DOCTYPE html>
<html>
<head>
<title>Table with database</title>
<style>
table {
border-collapse: collapse;
width: 100%;
color: #588c7e;
font-family: monospace;
font-size: 25px;
text-align: left;
}
th {
background-color: #588c7e;
color: white;
}
tr:nth-child(even) {background-color: #f2f2f2}
</style>
</head>
<body>
<table>
<tr>
<th>Id</th>
<th>First Name</th>
<th>Last Name</th>
<th>Address</th>
<th>City</th>
<th>State</th>
<th>Zipcode</th>
<th>Telephone</th>
<th>Email</th>
</tr>
<?php
$con = mysqli_connect('localhost','username','password');
if(!con) {
echo 'Error: Not connected to the server.';
}
if(!mysqli_select_db($con,'MPITdBase')) {
echo 'Error: Database is not selected';
}
$sql = "SELECT `custID` , `custLastName` , `custFirstName` ,
`custStreet` ,
`custCity` , `custState` , `custZipcode` , `custTX` , `custEmail`
FROM `Customer`";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
while($row = $result->fetch_assoc()) {
echo "<tr><td>"$row["custID"]"</td><td>"$row["custFirstName"]"</td>
<td>"$row["custLastName"]"</td><td>"$row["custStreet"]"</td>
<td>"$row["custCity"]"</td><td>"$row["custState"]"</td>
<td>"$row["custZipcode"]"
</td><td>"$row["custTX"]"</td><td>"$row["custEmail"]"</td></tr>";
}
echo "</table>";
} else { echo "0 results"; }
$conn->close();
?>
</table>
</body>
</html>