<?php
$gett = $_GET["q"];//获取数据
ini_set("precision", "4");  //浮点数小数位数
   class MyDB extends SQLite3
   {
      function __construct()
      {
			//$this->open('C:/Users/Administrator/Desktop/workFile/ElecWaterPrj/水文协议SL651 配置软件20220120/DB/SL651.sqlite.db3');
			$this->open('./Debug/DB/SL651.sqlite.db3');
      }
   }
   $con = new MyDB();
   if(!$con){
      echo $con->lastErrorMsg();
   } 
   
// 选择数据库
$sql="SELECT * FROM DevInfo ORDER by `devID`;";
$result = $con->query($sql);
//echo $sql;
if (!$result) {
    printf("Error: SELECT DB ERR\n");
    exit();
}


echo "<table border='1'>
<tr>
<th>设备ID</th>
<th>在线时间</th>
</tr>";
//SELECT 操作
while($row = $result->fetchArray(SQLITE3_ASSOC) )
{
    echo "<tr>";
	echo "<td>" . $row['devID'] . "</td>";
	echo "<td>" . $row['liveTime'] . "</td>";
    echo "</tr>";
}
echo "</table>";
$con->close();
 ?>