Skip to content
Advertisement

click button counter for all users PHP MySQL

I think it can be done with php and mysql but I’m not sure, so I ask you.

I have a site where every registered user has coins which are saved on the database.

I have a page with a button, and each user can click this button by spending 1 coin, and by doing this there will be a counter that will count how many coins have been spent (we can also think of them as clicks) but if a user has no coins he is redirected to “./ricarica.php”

any ideas?

Advertisement

Answer

I try to give you a minimal example (from our comment):

DB Structure:

Coin table:

JavaScript

User Table:

JavaScript

Html:

JavaScript

Js Call Ajax:

JavaScript

PHP:

JavaScript
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement