Save all data in one storage and display to a web page

Hey guys,
I created a quiz game and published it on my WordPress website. I want to save all the results in one storage and then display it on a page? Would txt file do the job or do I need to save it in a database or something?

Thanks in advance!

You would need to store it somewhere online, that’s for sure. The easiest way as of now would be to use Firebase Firestore.

I read the documentation about network. Is that an option that I can use as well?

You can but that would require you to code a server and would be unnecessarily harder than firebase, and very probably be less secure and performant and more expensive.

Okay I will try use firebase then. But where do I start? I only want to save one variable to the database which is the total correct answer/result.

You can always try one of my solutions if is just to store a score value.
https://www.wowscores.com/ or

examples for GDevelop for both projects.
Wow Scores you need to create your game and get API keys, the follow the example instructions to implement in your game.
Firebase is most robust and it’s worth for you to use it, but you can use one of those as an alternative.

2 Likes

http://wiki.compilgames.net/doku.php/gdevelop5/all-features/firebase
It works very similarly to local storage.
I use the firebase firestore for saving and loading results.
But you want to display the results outside the game in a WordPress sidebar or something? Should be possible but also needs code. If you only have one variable for the game, the network/json solution should be simpler.

Yes, I want to display the result on my WordPress page. I want to do the easiest way as I don’t have much time left for my project.

Thanks for the help everyone! I will do my best.


gameresult.php
<?php file_put_contents("gameresult.txt", $_GET["gameresult"]);?>

1 Like

i cannot upload a php file into the wordpress library?

There is no need to upload into Wordpress Media, you create a php file like my_scores.php and upload to the root folder of your server usually is http_docs or www or public_html then you create into GDevelop the JSON request and point to the url where the file is hosted if you put the file in the root directory then must be
Send “Get” request to “https://www.yourdomain.com/my_scores.php” …
If you choose to upload the file to other location then change the url of the request to point that location: like
Send “Get” request to “https://www.yourdomain.com/my_great_game/my_scores.php” …
Hope this helps

The txt will be created automatically if it doesn’t exist.
I think you don’t need “public” in the url, bc the domain is linked in this directory.

And the varibals are wrong.
You need 2, one for the saved result, to check if the current one is higher and the current one. You overwrite the loaded one and compares with a non-existent one.

If everything works, you should rename the php file and get-parameter-name, otherwise anyone who sees your screenshot can save any result.

I want to store the result every time someone plays my game not highscore?

I don’t know if that makes sense. But then you don’t need the first two events.
Only the one action, when you want to save.

Sorry, I will clarify. I made an educational game. What I am trying to achieve is to get the results of each user who play my game in one storage and display them on our website so that the teachers can see how well the students do with the quiz.

Ouw okay, that’s something completely different.
Sounds like you need accounts for every student?
Maybe you can draw graphically how the result site should look like.

It doesn’t have to be fancy as long as it’s displaying the data.
image

If that seems to be hard to achieve, maybe at least even just display the result and don’t need to track the users. Because I know that needs more php coding for session

Sorry to sound repetitive but WowScores is created specially to do what you want.

UlisesFreitas, But I want the leaderboard to display into my wordpress website?