This is my code, it’s a dashboard that shows data grabbed from mysql database. The tables in the database are correctly populated, all the data is actually there. But the page only shows the first row.
<html>
<HEAD>
<style>
a:link, a:visited {
background-color: #D80D30;
color: white;
padding: 15px 25px;
text-align: center;
text-decoration: none;
display: inline-block;
}
a:hover, a:active {
background-color: red;
}
myTable {
}
th {
position: sticky;
top: 0;
background-color: white;
}
td {
padding: 5px;
}
tr {
border-bottom: 1px solid #ddd;
}
tr.header, tr.hover {
background-color: #f1f1f1;
}
img.center {
display: block;
margin-left: 0;
margin-right: 0;
border: 0;
width: 100%;
height: 100%;
align-content: right;
align-self: right;
background-color: transparent;
}
a.a2 {
background-color: transparent;
text-align: right;
padding: 0px 0px;
position: fixed;
bottom: 10px;
right:0px;
z-index: 20;
width: 50px;
height: 50px;
}
</style>
<script>
function myFunction()
{
// Declare variables
var input, filter, table, tr, td, i, txtValue;
input = document.getElementById("myInput");
filter = input.value.toUpperCase();
table = document.getElementById("myTable");
tr = table.getElementsByTagName("tr");
// Loop through all table rows, and hide those who don't match the search query
for (i = 1; i < tr.length; i++) {
td = tr[i].getElementsByTagName("td")[0];
if (td) {
txtValue = td.textContent || td.innerText;
if (txtValue.toUpperCase().indexOf(filter) > -1) {
tr[i].style.display = "";
} else {
tr[i].style.display = "none";
}
}
}
}
function myFunction2()
{
// Declare variables
var input, filter, table, tr, td, i, txtValue;
input = document.getElementById("myInput2");
filter = input.value.toUpperCase();
table = document.getElementById("myTable");
tr = table.getElementsByTagName("tr");
// Loop through all table rows, and hide those who don't match the search query
for (i = 1; i < tr.length; i++) {
td = tr[i].getElementsByTagName("td")[1];
if (td) {
txtValue = td.textContent || td.innerText;
if (txtValue.toUpperCase().indexOf(filter) > -1) {
tr[i].style.display = "";
} else {
tr[i].style.display = "none";
}
}
}
}
function myFunction3()
{
// Declare variables
var input, filter, table, tr, td, i, txtValue;
input = document.getElementById("myInput3");
filter = input.value.toUpperCase();
table = document.getElementById("myTable");
tr = table.getElementsByTagName("tr");
// Loop through all table rows, and hide those who don't match the search query
for (i = 1; i < tr.length; i++) {
td = tr[i].getElementsByTagName("td")[2];
if (td) {
txtValue = td.textContent || td.innerText;
if (txtValue.toUpperCase().indexOf(filter) > -1) {
tr[i].style.display = "";
} else {
tr[i].style.display = "none";
}
}
}
}
</script>
<datalist id="type">
<option value="AdapterAllianz">
<option value="AdapterCarige">
<option value="AdapterCedacri">
<option value="AdapterCompass">
<option value="AdapterEurizon">
<option value="AdapterING">
<option value="AdapterISP">
<option value="Auth">
<option value="CR296">
<option value="DR">
<option value="Email">
<option value="ISP">
<option value="Mask">
<option value="MO">
<option value="MT">
<option value="MTOTP">
<option value="MultiEmail">
<option value="MultiMT">
<option value="PaydoCloud">
<option value="Push">
<option value="WAC">
<option value="WACIO">
<option value="WAT">
</datalist>
</HEAD>
<body>
<h1>INTEGRATION</h1>
<h2><a href="index.html">HOME</a><BR></h2>
<form action="update_int_notest.php" method="get">
<select name="type">
<option value="ALL" selected>ALL</option>
<option value="AdapterAllianzListenerSEC">AdapterAllianzListenerSEC</option>
<option value="AdapterAllianzListenerSIA">AdapterAllianzListenerSIA</option>
<option value="AdapterCarige">AdapterCarige</option>
<option value="AdapterCedacri">AdapterCedacri</option>
<option value="AdapterCompass">AdapterCompass</option>
<option value="AdapterEurizon">AdapterEurizon</option>
<option value="AdapterING">AdapterING</option>
<option value="AdapterISP">AdapterISP</option>
<option value="Auth">Auth</option>
<option value="CR296">CR296</option>
<option value="DR">DR</option>
<option value="Email">Email</option>
<option value="ISP">ISP</option>
<option value="Mask">Mask</option>
<option value="MO">MO</option>
<option value="MT">MT</option>
<option value="MTOTP">MTOTP</option>
<option value="MultiEmail">MultiEmail</option>
<option value="MultiMT">MultiMT</option>
<option value="PaydoCloud">PaydoCloud</option>
<option value="Push">Push</option>
<option value="WAC">WAC</option>
<option value="WACIO">WACIO</option>
<option value="WAT">WAT</option>
<option value="ubmApi">ubmApi</option>
<option value="ubmMT">ubmMT</option>
<option value="ubmRejected">ubmRejected</option>
<option value="ubmAdapters">ubmAdapters</option>
<option value="ubmMail">ubmMail</option>
<option value="ubmWA">ubmWA</option>
</select>
<br>
<p>Select refresh type:</p>
<input type="radio" id="incremental" name="range" value="incremental" checked>
<label for="incremental">Incremental</label><br>
<input type="radio" id="full" name="range" value="full">
<label for="full">Full</label><br>
<br>
<input type="submit" value="Refresh Data"/>
</form>
<table id="myTable" border="3" BORDERCOLOR=#F4982B>
<thead>
<tr >
<th><input list="type" id="myInput" onkeyup="myFunction()" placeholder="Search for type.."></th>
<th><input id="myInput2" onkeyup="myFunction2()" placeholder="Search for ID.."></th>
<th><input id="myInput3" onkeyup="myFunction3()" placeholder="Search for name.." width=100%></th>
<th align="center"><?php $date5 = date('d-m-Y',strtotime("-4 days"));print($date5); ?><br>
<a href="fail_int_filter_new.php?date=<?php print($date5); ?>">Filter</a></th>
<th align="center"><?php $date4 = date('d-m-Y',strtotime("-3 days"));print($date4); ?><br>
<a href="fail_int_filter_new.php?date=<?php print($date4); ?>">Filter</a></th>
<th align="center"><?php $date3 = date('d-m-Y',strtotime("-2 days"));print($date3); ?><br>
<a href="fail_int_filter_new.php?date=<?php print($date3); ?>">Filter</a></th>
<th align="center"><?php $date2 = date('d-m-Y',strtotime("-1 days"));print($date2); ?><br>
<a href="fail_int_filter_new.php?date=<?php print($date2); ?>">Filter</a></th>
<th align="center"><?php $date1 = date('d-m-Y');print($date1); ?><br>
<a href="fail_int_filter_new.php?date=<?php print($date1); ?>">Filter</a></th>
<th align="center">Note</th>
<th align="center">Insert</th>
<th align="center">Delete</th>
</tr>
</thead>
<?php
$servername = "localhost";
$username = "automation";
$password = "Kaleyra1!";
$dbname = "automation";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$sql_tests ="SELECT DISTINCT t.ID, h.test_type, h.test_name FROM int_tmp h left join testID_1 t on h.test_name=t.Name ORDER BY `t`.`ID`, h.test_type, h.test_name DESC";
$res_tests = $conn->query($sql_tests);
$date=date('Y-m-d',strtotime("-4 days"));
$sql_hist ="SELECT test_name, test_status, test_runtime FROM int_tmp where test_runtime > date("".$date."") order by test_runtime";
$res_hist = $conn->query($sql_hist);
$sql_bugs ="SELECT DISTINCT test_name,bug_id from bugs;";
$res_bugs = $conn->query($sql_bugs);
$sql_note="SELECT test_name,nota,insert_date from int_note ORDER BY insert_date desc";
$res_note=$conn->query($sql_note);
while ($test=$res_tests->fetch_assoc()) {
print("<tr><td>".$test["test_type"]."</td>");
print("<td>".$test["ID"]."</td>");
print("<td style="text-align:left">".$test["test_name"]."</td>");
for ($i=4;$i>=0;$i--) {
$present=FALSE;
while ($row = $res_hist->fetch_assoc()) {
if ($test["test_name"]==$row["test_name"] AND date('d-m-Y',strtotime($row["test_runtime"]))==date('d-m-Y',strtotime("-".$i." days"))) {
print("<td align="center"><img src="./img/".$row["test_status"].".png" width="30" height="30" ><br>".substr($row["test_runtime"],-8)."</td>");
$present=TRUE;
}
}
if ($present==FALSE) {
print("<td></td>");
}
$res_hist->data_seek(0);
}
print("<td>");
while ($bug = $res_bugs->fetch_assoc()) {
if ($bug["test_name"]==$test["test_name"]) {
print("<a href=https://kaleyra.atlassian.net/browse/".$bug["bug_id"].">".$bug["bug_id"]."</a><br>");
}
}
$res_bugs->data_seek(0);
while ($note = $res_note->fetch_assoc()) {
if ($note["test_name"]==$test["test_name"]) {
print($note["nota"]." - ".$note["insert_date"]."<br>");
}
}
$res_note->data_seek(0);
print("</td>");
print("<td><a href="ins_int.php?type=".$test["test_type"]."&name=".$test["test_name"]."" target="new">Insert</td>");
print("<td><a href="del_int.php?type=".$test["test_type"]."&name=".$test["test_name"]."" target="new">Delete</td>");
print("</tr>");
}
$conn->close();
?>
</table>
<a href="#top" class="a2"><img src="img/red-arrow.png" class="center"/></a>
</body>
</html>
The tables are correctly populated, but only the first row shows. I have tried multiple solutions, but can’t come up with a fix. It worked fine until early this morning, but now I can’t get it to show all the rows.