function majStatus($a_matos, $a_action) { $qry = "Select groupe from materiel where materielID = {$a_matos}"; $sqlCmdMatos = "update materiel set etat='{$a_action}' where materielID={$a_matos}"; $sqlCmdGroupe = "update materiel set etat='{$a_action}' where groupe={$a_matos}"; try { $db = new sqlite3($GLOBALS['dbaseName']); $result = $db->query($qry); $row = $result->fetchArray(); $group = $row[0]; if ($group == $a_matos) { $sqlCmd = $sqlCmdGroupe; } else { $sqlCmd = $sqlCmdMatos; } logMe("LIB : majStatus(\"{$sqlCmd}\")"); $db->exec($sqlCmd); $db->close(); } catch (Exception $e) { logme("ERROR : {$e}"); return; } }
/* Get connection to statement */ $db = new sqlite3($dbname); /* Prepared Statement creation */ $statement = $db->prepare('SELECT * FROM weather WHERE timestamp > :id;'); /* Bind Value to prepared statement */ $statement->bindValue(':id', $monthago); /* Results array */ $results = $statement->execute(); /* While loop to extract results array for charting */ while ($row = $results->fetchArray()) { $timestamp[] = $row["timestamp"]; $temperature[] = $row["temperature"]; $humidity[] = $row["humidity"]; } /* Close DB Connection */ $db->close(); //////////////////////////////////////////////////////////////// // Organise Data for Graphing // /* Load date time data */ $MyData->addPoints($timestamp, "Timestamp"); /* Load Temperature data */ $MyData->addPoints($temperature, "Temperature"); /* Load Humidity data */ $MyData->addPoints($humidity, "Humidity"); /* Set X-Axis */ $MyData->setAbscissa("Timestamp"); /* Set X-Axis name */ $MyData->setXAxisName("Time"); /* Setup Series Y-Axis 0 */ $MyData->setSerieOnAxis("Temperature", 0);