In this tutorial you will learn how to create your own Highscores for your games, using your own free server / database. Let's go! Here's an example of how the...
What about if you want to post more data? Like email that also should be a unique value and it should update when the user plays the game again?
name|email|score?
[Reply 2/2]
Step 1:
When you create the DB, add a new column email:
`name` VARCHAR( 20 ) NOT NULL ,
`email` VARCHAR( 60 ) NOT NULL ,
`score` INT NOT NULL ,
---------
Step 2:
Edit savescores.php (BE VERY CAREFUL, do not copy this, just use as a guide of where to add 'email'):
$name = strip_tags............ $_GET['name']));
$email = strip_tags........... $_GET['email']));
$score = strip_tags........... $_GET['score']));
....
Now, the INSERT.. name, email, score
VALUES $ name, $ email, $ score
----------
Step 3: Similar to reading name from player and sending it to
duquekarlgames.000webhostapp.com/savescores.php
Thank you. The data is inserted into the email column correctly, but when the user enters the higher score, it duplicated the data. It does not update it with the new score? It does not check if the email is already in the database.
Hey!
You can edit savescores.php to "insert" only new emails+score and "update" if existing email with the new scores.
ANother option is save eveything but getscores.php only returns the Best Score for each unique player(email). Something like this (your file extension must be .php):
duquekarlgames.000webhostapp.com/getscores-unique.txt
Let me know if that helps!
if I put this I get a blank page, because thanks
I don't have in my db max score table I have only score
[Reply 1/2]
To save an 'email' in your High Scores is very similar to saving the player's 'name'.
Read this tutorial and the PHPs and edit where you find 'name', then add 'email' too.
Step 1: add column email to DB
Step 2: edit savescores.php (and optionally getscores.php)
Step 3: from C2/C3 send the email too