Guest User

Untitled

a guest
Jan 19th, 2019
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. <?php $mysqli = new mysqli('localhost','root','xxxx','xxxx');
  2. $myArray = array();
  3. if ($result = $mysqli->query("SELECT CONCAT(Datum , ' ', Tijd) as Datum, KleurL FROM metingen order by Datum ASC limit 20")) {
  4. $tempArray = array();
  5. while($row = $result->fetch_object()) {
  6. $tempArray = $row;
  7. array_push($myArray, $tempArray);
  8. }
  9. echo json_encode($myArray,JSON_NUMERIC_CHECK);
  10.  
  11. $fp = fopen('resultsv2.json', 'w');
  12. fwrite($fp, json_encode($myArray,JSON_NUMERIC_CHECK));
  13. fclose($fp);
  14. }
  15.  
  16. $result->close();
  17. $mysqli->close(); ?>
  18.  
  19. [{"Datum":"17-01-2019 10:31:39","KleurL":17.68},{"Datum":"17-01-2019 11:10:59","KleurL":71.76},{"Datum":"18-01-2019 08:40:41","KleurL":70.7},{"Datum":"18-01-2019 10:30:01","KleurL":71.03},{"Datum":"18-01-2019 12:05:46","KleurL":70.56},{"Datum":"18-01-2019 14:31:58","KleurL":16.2}]
  20.  
  21. [
  22. [
  23. 17.68,
  24. 17-01-2019 10:31:39
  25. ],
  26. [
  27. 18.11,
  28. 17-01-2019 11:15:20
  29. ]
Add Comment
Please, Sign In to add comment