Mysql Update Firing Too Early with Jquery Countdown Timer

295
March 05, 2017, at 2:58 PM

I have a countdown timer that is supposed to fire a function when it's done counting which I have loaded a php page with. The problem is that the timer function executes the php update before the timer is done counting down. If i wanted to update the mysql ONLY when the timer is done, is there a better way to do this? Ive tried ajax but it becomes problematic.

$('#timerinsert').countdown(plustime)
.on('update.countdown', function(event) {
    $(this).html(event.strftime('%M:%S'));
})
.on('finish.countdown',function(event) {
    $(this).html("<?php include "timerdone.php"; ?>");
});

The PHP:

    $thegamesql = "UPDATE MYSQL FUNCTION GOES HERE";
mysql_query($thegamesql) or die (mysql_error());
Answer 1

Pending that your finish.countdown function fires properly, there's no reason that this shouldn't work for ya..

$('#timerinsert').countdown(plustime)
    .on('update.countdown', function(event) {
        $(this).html(event.strftime('%M:%S'));
    })
    .on('finish.countdown', function(event) {
        $.ajax({
            url: 'timerdone.php'
        }).done(function(html) {
            $(this).html(html);
        });
    });
READ ALSO
How do you remove the new line code (&amp;#10;) with php?

How do you remove the new line code (&#10;) with php?

Ok, so I was tasked with created a gallery, using a sql table is not an option, so I am doing what I canThis is my code, wich works fine, but it generates a hidden character at the end of every imate

181
PHP separated login for admin users

PHP separated login for admin users

someone helped on how to implement my login using different table but now i want different user in the specific table for example the stock manager has a separate page and separate page for the adminheres my code hope you understand just tell me if need to re edit for some reason

222
PHP Unable to retrieve data using GET Method

PHP Unable to retrieve data using GET Method

I am new to PHP, today I was trying to implement a get methodI am trying to get data based on a token that already exists but, unable to retrive data

224
while loop output increasing digits and break

while loop output increasing digits and break

i have here a problem that needs to output the same pattern as below

161