Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function daygenerate($sensor)
- {
- //START: includes necessary PHP files
- include("../conf/functions.php"); //file with functions
- include("../conf/settings.php");
- //SLUTT: includes necessary PHP files
- connect(); //connects to the database
- $todayarray = explode(":", date('d:m:Y:H:i:s'));
- $result = mysql_query("SELECT * FROM `tempsensor1` ORDER BY `ID`") or die("error: " . mysql_error());
- $forste = 1;
- $forste2 = 1;
- echo '
- {
- label: "Inne",
- data: [ ';
- while($row = mysql_fetch_array($result)){
- $date=$row['dato'];
- $temp = $row['temp'];
- $temoto = $row['temp2'];
- $dbdate = $row['dato'];
- $lastarray = explode(":", $dbdate);
- if($lastarray[0] == $todayarray[0] && $lastarray[1] == $todayarray[1] && $lastarray[2] == $todayarray[2] )
- {
- if($forste == 1)
- {
- $forste = 2;
- }
- else
- {
- echo ", ";
- }
- echo "[".$lastarray[3].",".$temp."]";
- }}
- echo ']},
- {
- label: "Inne",
- data: [ ';
- $resultt = mysql_query("SELECT * FROM `tempsensor1` ORDER BY `ID`") or die("error: " . mysql_error());
- //echo "[".$lastarray[3].",".$tempto."]]}";
- while($row = mysql_fetch_array($resultt)){
- $date=$row['dato'];
- $temp = $row['temp2'];
- $dbdate = $row['dato'];
- $lastarray = explode(":", $dbdate);
- if($lastarray[0] == $todayarray[0] && $lastarray[1] == $todayarray[1] && $lastarray[2] == $todayarray[2] )
- {
- if($forste2 == 1)
- {
- $forste2 = 2;
- }
- else
- {
- echo ", ";
- }
- echo "[".$lastarray[3].", ".$temp."]";
- }
- //QUERY "
- //QUERY " $result = mysql_query("SELECT * FROM `tempsensor1` ORDER BY `ID`") or die("error: " . mysql_error());QUERY " $result = mysql_query("SELECT * FROM `tempsensor1` ORDER BY `ID`") or die("error: " . mysql_error()); "
- }
- echo "]}";
- }
- mysql_close(); //close the database connection
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement