I have a function
in Javascript that executes a PHP code, in this PHP I open connection to the database and send data if some entries receive 1 (waiting 1 minute to change their state).
When I refresh the page before this 1 minute, it performs Javascript and PHP again, thus creating a new connection to the database and creating more than one record at runtime.
What can I do? How can I stop execution of PHP code when updating the page? Would it be easier to terminate database connections when running PHP?