コード例 #1
0
}
$db->close();
?>
					</tbody>
				</table>
			</div>
		</div class="container"> <!-- /container -->
		
		<div class="container">
			<br>
			<h4></h4>
			<table class="table table-striped" style="width:600px">
				<tbody>
					<tr>
					<?php 
$db = new MyLiveDB();
if (!$db) {
    echo $db->lastErrorMsg();
}
$sql = "SELECT * FROM battery LIMIT 1;";
$ret = $db->query($sql);
while ($row = $ret->fetchArray(SQLITE3_ASSOC)) {
    echo "<td><b>Avg Cell Voltage: </b>" . number_format($row['batt1Avg'], 2, '.', '') . "V </td>";
    echo "<td><b>Highest Cell Voltage: </b>" . number_format($row['batt1High'], 2, '.', '') . "V </td>";
    echo "<td><b>Lowest Cell Voltage: </b>" . number_format($row['batt1Low'], 2, '.', '') . "V </td>";
}
$db->close();
?>
					</tr>
				</tbody>
			</table>
コード例 #2
0
 class MyLiveDB extends SQLite3
 {
     function __construct()
     {
         $this->open('/data/databases/Live.db');
     }
 }
 //grab data from database
 class MyFaultDB extends SQLite3
 {
     function __construct()
     {
         $this->open('/data/databases/FaultDictionary.db');
     }
 }
 $dbL = new MyLiveDB();
 if (!$dbL) {
     echo $dbL->lastErrorMsg();
 }
 $dbF = new MyFaultDB();
 if (!$dbF) {
     echo $dbF->lastErrorMsg();
 }
 $dataExists = False;
 $sqlL = "SELECT faultID FROM faults WHERE date = \"{$today}\";";
 $retL = $dbL->query($sqlL);
 while ($rowL = $retL->fetchArray(SQLITE3_ASSOC)) {
     if (!$dataExists) {
         $dataExists = True;
         echo "<table class=\"table table-striped\">";
         echo "<thead><tr>";