I'm working on a Automatic Home project with a Raspberry works as a server and several Arduino clients. I created a database with SQLite on Raspberry but when I'm working with PHP web interface, I encountered a strange behavior of my PHP script. This is it:
Code: Select all
<html>
<head>
<title>PHP Test</title>
</head>
<body>
<?php
$db = new SQLite3('/home/pi/webapp/DB.db');
$result = $db->query('SELECT * FROM temps;');
while ($res = $result->fetchArray(SQLITE3_ASSOC)){
print ("Date: " . $res["date"] . " ");
print ("Date: " . $res["time"] . " | ");
print ("Temperature: " . $res["temperature"] . " <br \>");
}
$db->close();
?>
</body>
</html>
Code: Select all
query('SELECT * FROM temps'); while ($res = $result->fetchArray(SQLITE3_ASSOC)){ print ("Date: " . $res["date"] . " "); print ("Date: " . $res["time"] . " | "); print ("Temperature: " . $res["temperature"] . "
"); } $db->close(); ?>
