I have a table pulling in long columns of data from my database. The issue is that the table spans the entire width and length of the page, and displays over my footer. Here is what the formatting looks like:
http://test.ishabagha.com/classic_cars/customer_entry.php
I created a div
(div id="table2")
in which I set boundaries in how far the table should stretch vertically and horizontally. I added padding: 50px
so that there would be space above the footer, but the padding is only being applied to the top of the table. Here is the style I added (I changed the height and width to multiple px
to test if the size of the table would change, but it does not):
<style>
#table2{
width: 100px;
height: 50px;
padding: 50px;
}
</style>
I would like the table to shrink to a smaller size. I would appreciate anyone letting me know why my content in the div id="table2"
will not allow my to set the height/width/padding of the table, and why it is overwriting the footer.
Here is the whole code, if needed.
<?php
require_once("./includes/database_connection.php");
error_reporting(E_ALL);
ini_set('display_errors', 1);
$query = "SELECT customerNumber, customerName, contactLastName, contactFirstName, phone, addressLine1, addressLine2, city, state, postalCode, country, salesRepEmployeeNumber, creditLimit FROM customers ORDER BY customerNumber ASC";
$result = mysqli_query($dbc, $query)
or die ('Error querying database');
?>
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8'>
<title>Home</title>
<link type="text/css" rel="stylesheet" href="classic_cars.css" />
<style>
#table2{
width: 100px;
height: 50px;
padding: 50px;
}
</style>
</head>
<div>
<body>
<?php
require_once("./includes/navigation.php");
?>
<div id="table2">
<table border= "1">
<tr>
<td>customerNumber</td>
<td>customerName</td>
<td>contactLastName</td>
<td>contactFirstName</td>
<td>phone</td>
<td>addressLine1</td>
<td>addressLine2</td>
<td>city</td>
<td>state</td>
<td>postalCode</td>
<td>country</td>
<td>salesRepEmployeeNumber</td>
<td>creditLimit</td>
</tr>
<?php
while($row = mysqli_fetch_array($result)) {
$customer_number = $row['customerNumber'];
$customer_name = $row['customerName'];
$contact_last_name = $row['contactLastName'];
$contact_first_name = $row['contactFirstName'];
$phone_number = $row['phone'];
$address_1 = $row['addressLine1'];
$address_2 = $row['addressLine2'];
$city = $row['city'];
$state = $row['state'];
$postal_code = $row['postalCode'];
$country = $row['country'];
$salesrep_number = $row['salesRepEmployeeNumber'];
$credit_limit = $row['creditLimit'];
echo "<tr>
<td>$customer_number</td>
<td>$customer_name</td>
<td>$contact_last_name</td>
<td>$contact_first_name</td>
<td>$phone_number</td>
<td>$address_1</td>
<td>$address_2</td>
<td>$city </td>
<td>$state</td>
<td>$postal_code</td>
<td>$country</td>
<td>$salesrep_number</td>
<td>$credit_limit</td>
</tr>";
} // end while loop
?>
</table>
</div>
<?php
require_once("./includes/footer.php");
?>
</body>
</html>