Calling a function every 60 seconds

If you don’t care if the code within the timer may take longer than your interval, use setInterval(): setInterval(function, delay) That fires the function passed in as first parameter over and over. A better approach is, to use setTimeout along with a self-executing anonymous function: (function(){ // do some stuff setTimeout(arguments.callee, 60000); })(); that guarantees, … Read more

Execute the setInterval function without delay the first time

It’s simplest to just call the function yourself directly the first time: foo(); setInterval(foo, delay); However there are good reasons to avoid setInterval – in particular in some circumstances a whole load of setInterval events can arrive immediately after each other without any delay. Another reason is that if you want to stop the loop … Read more

setTimeout or setInterval?

They essentially try to do the same thing, but the setInterval approach will be more accurate than the setTimeout approach, since setTimeout waits 1000ms, runs the function and then sets another timeout. So the wait period is actually a bit more than 1000ms (or a lot more if your function takes a long time to … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)