results of sqlite query displayed in table won't stay on screen

Ask about general coding issues or problems here.

Moderators: egami, macek, gesf

Post Reply
pizzipie
New php-forum User
New php-forum User
Posts: 19
Joined: Sun Aug 04, 2019 4:10 pm

Tue Dec 10, 2019 11:50 am

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: Select all

<?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> 
User avatar
hyper
php-forum GURU
php-forum GURU
Posts: 927
Joined: Mon Feb 22, 2016 5:52 pm

Tue Dec 10, 2019 2:27 pm

You have changed something, I'll wager the css.

Check the source code through your browser ctrl + u to see if your table is there.
pizzipie
New php-forum User
New php-forum User
Posts: 19
Joined: Sun Aug 04, 2019 4:10 pm

Tue Dec 10, 2019 3:38 pm

Thanks hyper, you were correct. I changed some of the CSS before and somehow did something wrog. Eorks fine now!!

R
Post Reply