I have a question that is more of a PHP technical question rather than an AppGini specific one. However, the data I'm working with is from my AppGini application and is a simple (seemingly) effort to improve the output of a PHP table.
I'm simply trying to add row numbers to the table produced from data in one of the tables. I thought I had it figured out. When using Xampp it works great. But when I run the same php code on the real server the numbering skips the first record. I have included the php code and a screen shot illustrating the first record without numbering. This forum has always helped me solve problems and I am hoping someone has a suggestion or two.
The people who will be viewing this file have no access to my AppGini application so I can't really use that interface to illustrate this data.
This seems so simple but I don't know where else to look for help.
Thank you as always!
RAY
Code: Select all
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css">
<title>Orientation</title>
<!-- CSS only bootstrap
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-0evHe/X+R7YkIZDRvuzKMRqM+OrBnVFBL6DOitfPri4tjfHxaWutUpFmBp4vmVor" crossorigin="anonymous">-->
<style>
h1 { font-size:1.5em; text-align: center}
td {padding: 5px 15px 0px 10px;
font-size: 1.25em;}
th {background-color: LightCyan; font-size: 1em; padding: 5px 15px 5px 10px; text-align: center;}
p {font-size: .75em; text-align: center}
</style>
</head>
<body align="center">
<h1>Orientation Completions</h1>
<p>1 Year Look Back</p>
<table align="center" border="1px solid black"; style="border-collapse: collapse">
<tr>
<th>#</th>
<th>First Name</th>
<!--<th>Last Name</th>-->
<th>Completion Date</th>
</tr>
</thead>
<tbody>
<?php
$servername = "localhost";
$username = "USER";
$password = 'PASSWORD';
$database = "DATABASE";
//create connection
$connection = new mysqli($servername, $username, $password, $database);
//check connection
if ($connection->connect_error) {
die("Connection Failed: " . $connection->connect_error);
}
// Set counter at 0
$i = 0;
// read all rows from database table
$sql = "SELECT * FROM completions WHERE timecompleted >= 1704110077";
$result = $connection->query($sql);
//read data of each row
WHILE($row = $result->fetch_assoc()){
echo "<tr>
<td>" . $i++ . "</td>
<td>" . $row["firstname"] . "</td>
<td>" . $row["Completion_Date"] . "</td>
</tr>";
}
?>
</tbody>
</table><br>
</body>
</html>