Thanks, Tom! :) Glad you like it!
This is weird. I guess you are using the same .capx, only changed the DOMAIN_SCORE.
On the top right corner can you see the Best Score? Name + Score?
Like: "Best Score: THE_BOSS - 1337"
If you try getscores.php does the name show? WHat is the first name? Does it have any special chars?
Hi, are you using you own Database or the tutorial database?
I found some small typos in the last version uploaded to duquekarlgames.000webhostapp
You can paste this in savescores.php, under the Error Msg you get:
echo("<br>Error description: " . mysqli_error($con));
Then paste here the new error msg
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!
[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
[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
Can you confirm the score is saved correctly in the database (phpMyAdmin)?
getscores.php only returns the best 10 scores. If the new score is very low, it will not appear. Are you sure the new score is in the top 10?
You can try to edit the getscores.php and remove the "LIMIT 10" part, so ALL scores will be shown.
Another possibility. Some hostings have an option for fast loading "optimization". It works like this: the first time you open a URL like myweb.com/something, then they save ("screenshot" or "cache") the current path url and never update it again. So they will show the same cache URL for weeks/months and will not update the content. This could also be one of the reasons?
Send a test score and check if the Database table is updated (in phpMyAdmin).
Then, check is getscores.php is showing the new score.
Then, check if the C2 game is reading the scores correctly.
Happy to help! Send your leaderboard when game is ready ;)
PS: If you liked it, thumbs up or favorite the tutorial!
Yes, can be done. Depends on what you specifically want?
Great! Yes, it should work in C3 as well.
If you liked my tutorial, give it some love! A thumbs up or Favorite, so it can help others too ;)
Yes!
Open 'getscores.php' and replace "ORDER BY score DESC" (scores are ordered DESCending - higher first then lower) with "ORDER BY score ASC" (scores will be ordered ASCending - lowest values first, then higher)
// Retrieve data from database
$sql = "SELECT *
FROM scores
ORDER BY score DESC // Replace 'DESC' with 'ASC'
LIMIT 10"; // The 'LIMIT 10' part will only read 10 scores. Feel free to change this value
Yes, it works for me even with 2-3 scores.
I read you already made it work. Congrats!
I'm glad it is working for you! :)
Member since 10 Mar, 2015