Hi,
I queried a sqlite database successfully and displayed results in table. I've run this repeatedly with no problem, then inexplicably the results will no longer stay on the screen. All you see is the results flash by and then a blank screen.
The text from the two echo statements 'Opened Database Successfully' and 'Closed Database Successfully' does remain on the screen. I re-booted the computer but this condition did not change,
Thanks for help in advance. R
Here is code:
Code:
<?php
set_include_path( './include' );
error_reporting (E_ALL ^ E_NOTICE);
class MyDB extends SQLite3 {
function __construct() {
$this->open('renoAZID.db');
}
}
$db = new MyDB();
if(!$db) {
echo $db->lastErrorMsg();
} else {
echo "Opened Database Successfully\n";
}
$sql =<<<EOF
SELECT * from rdata ORDER BY Category;
EOF;
?>
<!DOCTYPE html>
<html>
<head>
<title>Wed 04 Dec 2019 Renovation Data</title>
<link rel="stylesheet " type="text/css" href="renoAZID.css" />
</head>
<body>
<table id="t01">
<th>Id</th> <th>Date</th> <th>Location</th> <th>Vendor</th> <th>Description</th>
<th>Category</th> <th>Paid By</th> <th>AcctNo</th> <th>Amount</th>
<h2>Renovation Data</h2>
<?php
$count=0;
$ret = $db->query($sql);
while($row = $ret->fetchArray(SQLITE3_ASSOC) ) { // runs SELECTION query on Table rdata
?>
<tr>
<td> <?php echo $row['Id'] ?></td>
<td> <?php echo $row['Date']?></td>
<td> <?php echo $row["Location"]?></td>
<td> <?php echo $row["Vendor"]?></td>
<td> <?php echo $row["Description"]?></td>
<td> <?php echo $row["Category"]?></td>
<td> <?php echo $row["PaidBy"]?></td>
<td> <?php echo $row["AcctNo"]?></td>
<td> <?php echo number_format($row["Amount"],2)?></td>
</tr>
<?php
$count++;
if($count==20) { // lets see header line after 20 lines of data
?>
<th>Id</th> <th>Date</th> <th>Location</th> <th>Vendor</th> <th>Description</th>
<th>Category</th> <th>Paid By</th> <th>AcctNo</th> <th>Amount</th>
<?php
$count=0;
} // if
} // while
$db->close();
echo "<br>Closed Database Successfully";
?>
</table>
</body>
</html>