0
I am trying to write in a file . json, information I collect from a database but for some reason nothing is written.
Follow the code:
require_once('../helpers/connect.php');
require_once('../models/marks.php');
$marks = Mark::select($pdo);
$rows = array();
if (isset($marks)) {
foreach ($marks as $row) {
$rows[] = array('id' => $row['id'], 'titulo' => $row['titulo'], 'descricao' => $row['decricao'], 'latitude' => $row['latitude'], 'longitude' => $row['longitude']);
}
}
$file = fopen('c:/xampp/htdocs/hemoba/assets/js/marks.json', 'w+');
fwrite($file, json_encode($rows));
fclose($file);
?>
Makes a mistake?.
– Miguel
Hello Miguel, no
– Felipe Regino