Hi I am looking for some advice. I have a quiz developed and wanted to create the following but cant find much in the way of help with reporting points earned in the quiz to a database.
Goal of project:
Store two variables containing quiz score & username using local storage
Save these values into an online database that I have already created
Pull all data from the database table and display it live on a webpage
Delete all of the saved data from the database to start fresh at any time (admin only)
My hope is that once a new user completes a quiz the score will automatically update the live leaderboard with their score and username.
**Using Hype to create the leaderboard would be my preferred method to display the database user data.
Hi,
some clues to the type of database???, and its API / access /file types / and any other info that would give someone an idea of how to fetch and send to it. probably would help.
Also it maybe an idea to set up a dummy one for said person to test against…
If anyone would like to use the test database please message me with your ip address and I can give you remote access to the database to test - many thanks
Note that you can’t really communicate directly to a MySQL database via client-side JavaScript. You in general need to have some sort of bridging code running on a server. The client-side javascript talks to it via AJAX request, and then this code does the writing/reading to the database.
Awesome thanks @jonathan its been a while since I worked on a backend database, thanks for the advice. Do you know of any hype examples / tutorials that might give me a working example of how to get started with this?
There are some other examples if you search “ajax mysql” or “ajax php” on the forums; the backend part is really outside the domain of Hype and heavily dependent on technology choices. The general route is that you’d want anything that can send JSON over HTTP requests.
Have you looked into any other service that wouldn’t require a “backend” language so to speak? Something, using a Database As AService (DaaS) for example. Like Google’s firebase, or AWS.
I’d be happy to show you an example using Firebase. Added benefit is that it can truly be “live” as in the scores can update/change over several browsers at the same time.
No that never crossed my mind but I can see the benefits. I don’t have a firebase / AWS account at the moment but I would be extremely interested in seeing a simple example of how this might work if it was achievable your end in the coming days / weeks.
I am currently finishing a build of Hype a quiz app so will be 2 weeks before the app is complete and ready to push user scores to a backend database.