| re: Remaining time from db with no page refresh
The previous suggestion using a countdown timer written in Javascript on the client side is a good suggestion.
But if you still for some reason need to read values from the database (or for that matter periodically call any PHP script in the background) then you can associate a function that does this background call, for example using Ajax or, as I do it, by submitting a hidden iframe on the page, with a Javascript countdown timer.
In words:
1) On page load, a javascript function is called which initiates a timer.
2) When the timer has counted down to zero, a function is called which does your background tasks (database query, updating fields or values on the current page) using Ajax or by just submitting a hidden iframe.
3) The javascript function which initiates the timer is then called again.
If, for example, you set the timer to 30 seconds, then your background query will be carried out every 30 seconds and then the timer will start counting again.
|