php-long-polling icon indicating copy to clipboard operation
php-long-polling copied to clipboard

Problems with database binding.

Open Arwik228 opened this issue 6 years ago • 2 comments

It was necessary to chat about this technology, everything seems to be usually updated on the example of the file, but how to update the query?
`set_time_limit(0); while (true) { $data_source_file = R::findLast('messages', 'dialog = ? ',array($_GET['getmess'])); $last_ajax_call = isset($_GET['timestamp']) ? (int)$_GET['timestamp'] : null; clearstatcache(); $last_change_in_data_file = $data_source_file->date; if ($last_ajax_call == null || $last_change_in_data_file > $last_ajax_call) { $data = $data_source_file->message; $result = array( 'data_from_file' => $data, 'timestamp' => $last_change_in_data_file ); $json = json_encode($result); echo $json; break;

} else {
    sleep(1);
    continue;
}

}`

Well, roughly, the date of the last message looks like this $data_source_file->date;

Arwik228 avatar Aug 16 '18 06:08 Arwik228

Sorry I dont understand what you mean! Can you please give a error description ?

panique avatar Aug 16 '18 11:08 panique

Error: works well with file change (test version), but can not work with sql-query

Arwik228 avatar Aug 16 '18 11:08 Arwik228