MySQL Forums
Forum List  »  PHP

Aligning HTML table columns in PHP
Posted by: Parker Shannon
Date: January 17, 2022 07:47AM

Do you know how to get these columns to align? Is it even possible?

Results can be seen at: https://database39.com/trafficlog.php

Thank you very much.

<?php

// fetch log records from database
$row = mysqli_query($dbconnect,"SELECT * FROM log
ORDER BY zipcode
LIMIT 100;");

// Loop Through Dataset
while ($fields = mysqli_fetch_array($row))
{
$address = $fields['address'];
$city = $fields['city'];
$state = $fields['state'];
$zipcode = $fields['zipcode'];
$longitude = $fields['longitude'];
$latitude = $fields['latitude'];
?>

<!-- Present Table -->
<table id="traffic">
<tr>
<td text-align: left;><?php echo $address; ?></td>
<td text-align: left;><?php echo $city; ?></td>
<td text-align: left;><?php echo $state; ?></td>
<td text-align: left;><?php echo $zipcode; ?></td>
<td text-align: left;><?php echo $longitude; ?></td>
<td text-align: left;><?php echo $latitude; ?></td>
</tr>

<?php
// End While Loop
$countah = $countah + 1;
}
?>

<!-- End Table -->
</table>
<br />

<?php
echo "Total Unique IP Addresses (Limit = 100): " . $countah . "<br>";
?>


Thank you very much again . . .

Options: ReplyQuote


Subject
Written By
Posted
Aligning HTML table columns in PHP
January 17, 2022 07:47AM


Sorry, only registered users may post in this forum.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.