1
I have a script that runs every time a particular page is loaded.
Basically, it does a database search and saves the values in a file:
$servicos = $db->prepare('SELECT id_servico, UNIX_TIMESTAMP(data) dia, user, cliente, situacao FROM servicos);
$servicos->execute(array());
$servicos_result = $servicos->fetchAll(PDO::FETCH_OBJ);
$out = array();
foreach($servicos_result as $row) {
$out[] = array(
'id' => $row->id_servico,
'user' => $row->loja,
'cliente' => $row->cliente,
'situacao' => $row->situacao,
'start' => $row->dia . '000',
'end' => $row->dia . '000'
);
}
$stringData = json_encode(array('success' => 1, 'result' => $out));
file_put_contents ( "events.json.php" , $stringData );
The problem is that it has taken a while for the file to be updated after some change in the bank. That is: it is not updated the first time the page is loaded, but only after a few minutes and attempts.
The file is about 400kb.
This may be some server limitation?
Write permission in directory?
– ShutUpMagda
@Shutupmagda. The file has 666 permission. The information is saved, but it takes too long.
– marcelo2605
What is the time of completion of the consultation itself?
– Ismael
@Smael By The Workbench is being at 0.078 sec / 0.282 sec
– marcelo2605
@marcelo2605 I deleted my previous comments to not leave mess under your question, as it is already solved. Any new questions, open a question, or if you have questions about this one, leave a comment on the answer I’ll return if you are online.
– Bacco