Really stuck on this one. Spent a couple hours fiddling and no results so asking here...
Tried solutions from html/CSS to Javascript and jQuery, but couldn't get anything to work. Basically trying to accomplish freeze panes like in Excel with the below table. For this I am most interested in freezing the first 4 columns. I might be interested in freezing the first 'header' column too, but not as important.
This is an example, but I will likely use this is a situation where I have multiple tables on a single page (so thinking if we had a frozen header it would need to stop at the end of each table).
<!DOCTYPE html>
<html>
<head>
<style>
table, th, td {
border: 1px solid black;
}
</style>
</head>
<?php
$servername = "";
$username = "";
$password = "";
$dbname = "";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$sql = "
SELECT fac_id, abc_id, provider_id, fac_name, status, lob, service_level, rate, start_date, end_date, fiscal_month_end, month_start, region, area, bd, pd, phone_pd, ps, total_beds, licensed_beds, address, city, state, zip, phone_office, logo_1, logo_2
FROM table_db
WHERE status = 'ACTIVE' AND lob = '123' AND area = 'Smith'
ORDER BY region ASC, area ASC, fac_name ASC
";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
echo "<table cellpadding=5><tr><th>Fac ID</th><th>ABC ID</th><th>Provider ID</th><th>Fac Name</th><th>Service Level</th><th>Rate</th><th>Start Date</th><th>Fiscal Month End</th><th>Month Start</th><th>Region</th><th>Area</th><th>BD</th><th>PS</th><th>PD</th><th>PD Phone</th><th>Total Beds</th><th>Licensed Beds</th><th>Address</th><th>City</th><th>State</th><th>Zip</th><th>Office Phone</th><th>Logo 1</th><th>Logo 2</th></tr>";
// output data of each row
while($row = $result->fetch_assoc()) {
echo "<tr><td>" . $row["fac_id"]. "</td><td>" . $row["abc_id"]. "</td><td>" . $row["provider_id"]. "</td><td>" . $row["fac_name"]. "</td><td>" . $row["service_level"]. "</td><td>" . $row["rate"]. "</td><td>" . $row["start_date"]. "</td><td>" . $row["fiscal_month_end"]. "</td><td>" . $row["month_start"]. "</td><td>" . $row["region"]. "</td><td>" . $row["area"]. "</td><td>" . $row["bd"]. "</td><td>" . $row["ps"]. "</td><td>" . $row["pd"]. "</td><td>" . $row["phone_pd"]. "</td><td>" . $row["total_beds"]. "</td><td>" . $row["licensed_beds"]. "</td><td>" . $row["address"]. "</td><td>" . $row["city"]. "</td><td>" . $row["state"]. "</td><td>" . $row["zip"]. "</td><td>" . $row["phone_office"]. "</td><td><a href='/logo/" . $row["logo_1"]. "'>" . $row["logo_1"]. "</a></td><td><a href='/logo/" . $row["logo_2"]. "'>" . $row["logo_2"]. "</a></td></tr>";
}
echo "</table>";
} else {
echo "0 results";
}
$conn->close();
?>
</body>
</html>