Answer the question
In order to leave comments, you need to log in
A timer that doesn't stop the script?
I need to make an infinite timer, but when the script is run, it just loops and does not allow the rest of the code to work, it is impossible to get a variable using ajax, how can I implement the timer differently?
# Таймер
while(1) {
if($pump > 200) continue; // Условие не пропускает дальше код если насос не работает
if(date("H:i:s") == '23:59:59') { // Проверка времени если время 00:00 запись в базу данных и обнуляем таймер
# Переводим секунды в минуты
$time = date("i", mktime(0, 0, $time));
# Получаем текущую дату
$date = date('Y.m.d H:i:s');
# Запрос в базу данных на добавление новой записи
$sql = "INSERT INTO
`timeupdate` (`time`, `date`) VALUES '{$time}', {$date}";
$dbh->query($sql);
}
$time++;
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question