Witam, dlaczego gdy zrobie if(minuty i sekundy sa rowne 0) w tym kodzie i dodam insert do bazy php to odrazu dodaje do bazy zanim zaczekać ?
var a = "<?php $cons = mysqli_connect('localhost','root','','bn'); $sql = 'INSERT INTO mecze (imie) VALUES ('123')'; mysqli_query($ ?>";
function startTimer(duration, display) {
diff,
minutes,
seconds;
function timer() {
// get the number of seconds that have elapsed since
// startTimer() was called
diff
= duration
- (((Date.now
() - start
) / 1000
) | 0
);
// does the same job as parseInt truncates the float
minutes = (diff / 60) | 0;
seconds = (diff % 60) | 0;
minutes = minutes < 10 ? "0" + minutes : minutes;
seconds = seconds < 10 ? "0" + seconds : seconds;
display.textContent = minutes + ":" + seconds;
if (diff <= 0) {
// add one second so that the count down starts at the full duration
// example 05:00 not 04:59
start
= Date.now
() + 1000; }
};
// we don't want to wait a full second before the timer starts
timer();
setInterval(timer, 1000);
}
window.onload = function () {
var fiveMinutes = 10,
display = document.querySelector('#time');
startTimer(fiveMinutes, display);
};
Ten post edytował wiktor0000 19.04.2020, 14:55:57