One of my pages has a big table that displays info from a database but the data runs down the page so if i were to view data at the bottom i would have to scroll down then I wouldn't be able to see the titles of the data from the top of the page. So i put the table into a scroll box. My problem is that the data is so spread apart in the scroll box. I have no idea why. Here is a copy of my code.

<div style="overflow:auto; height:400px; width:1250px">
<table cellpadding="0" cellspacing="0" style="width:50px;">
<?php
echo "<table border='1'>";
echo "<tr>"; 
echo "<td>" .$row['School'] . "</td>";
echo "<td>" .$row['Teacher'] . "</td>";
if(!strcmp($row['dtFirstContactSt'], '0000-00-00')) {
echo "<td>" . "No Date </td>";
} else {
echo "<td>" .$row['dtFirstContactSt']. "</td>";
}
if(!strcmp($row['dtDevelopmentSt'], '0000-00-00')) {
echo "<td>" . "No Date </td>";
} else {
echo "<td>" .$row['dtDevelopmentSt']. "</td>";
}
if(!strcmp($row['dtDevelopmentEnd'], '0000-00-00')) {
echo "<td>" . "No Date </td>";
} else {
echo "<td>" .$row['dtDevelopmentEnd']. "</td>";
};
if(!strcmp($row['dtPricingSt'], '0000-00-00')) {
echo "<td>" . "No Date </td>";
} else {
echo "<td>" .$row['dtPricingSt']. "</td>";
}
if(!strcmp($row['dtPricingEnd'], '0000-00-00')) {
echo "<td>" . "No Date </td>";
} else {
echo "<td>" .$row['dtPricingEnd']. "</td>";
}
if(!strcmp($row['dtMarketingSt'], '0000-00-00')) {
echo "<td>" . "No Date </td>";
} else {
echo "<td>" .$row['dtMarketingSt']. "</td>";
}
echo "<td>" .$row['PriceBasedOn']. "</td>";
echo "<td>" .$row['TripAssignedTo']. "</td>"; 
 ?>
<td><input type="checkbox" name="TripMade" value="Yes" <?= $checkbox ?>></td>
<td><textarea name="Notes" rows="1" cols="10"><?php echo $row["Notes"]?></textarea> </td>
<?php
echo "<td>" . "<a href=Edit_Form.php?UniqueIdentifier=$row[UniqueIdentifier]> Edit </a></td>";
echo "</tr>";
}
echo "</table>";
echo "</div>";

Any ideas?

Recommended Answers

All 2 Replies

Obviously, this code snippet is inside of a loop which is retrieving the information from the database. Here's an idea. Try setting a counter and creating a new table row containing repeating headers. That way, every 30 rows or so, you'll have new headers so that when you scroll down, you will have column headers no matter how far down you have to scroll.

Member Avatar for rajarajan2017

Better you do pagination in your display. Display only 20 records and have next link to view next 20 records etc.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.