Problems with mysql, php, databases and online highscores

0 favourites
  • 5 posts
From the Asset Store
Paypal PHP Supports multiple platforms, Web/html5 Android, IOS. (Including storing transaction data)
  • hi,

    so i created online highscores a while back for a game using this tutorial:

    construct.net/en/tutorials/creating-own-leaderboard-1032/page-3

    everything works perfectly fine.

    so recently i wanted to do another game with online highscores.

    so i copypaste the php from earlier and changed the required values. test it - doesn't work. now i am stumped.

    PLEASE READ:

    I created a new database, this time it uses mysq l5.7 instad of 5.5 - cant change that, server-side thing

    i changed all the values correctly. no error on that end

    the new database is an exact copy of the old one for testing

    i used the new php to upload scores to the old one to see if it works. it does. so neither the game code nor the PHP is not at fault here

    i can read the tables just fine, the scores are displayed as they should. the problem is the upload part. i made sure to get all the values and php right - as said, if i use the new code to upload to the old scores it works fine.

    so here's my problem: did the syntax change a lot from sql5.5 to 5.7? if so, how do i need to reflect the changes in my code?

    as said the old game, where everything works fine, used a 5.5 version, the new one 5.7 and that is the only difference between the two. it either is that or something so obvious I can't help but miss it.

    any ideas?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • I doubt the syntax has changed, the problem is most likely with something like permissions. Maybe this user doesn't have write permission for this table.

    There is another zip attached to the tutorial - php7.zip, have you tried it? It's using different functions to connect and write to the database - mysqli_connect and mysqli_query. (notice the letter "i"). Maybe they will work?

  • I used that file from the latest zip (php7) and it does not work. Apparently I am not the only one having this problem as the latest comment on that also seems to be the same issue. I can read the table just fine, but uploading doesn't work. It did work with the previous game using mysql 5.5 so I am pretty sure it is something with the database. But I can't figure out what...

  • 1. Try opening script url from the browser like this:

    http://yourserver.com/savescores.php?name=john&score=999
    

    Try both http and https.

    See if there are any errors on the screen or in browser console. Check if the record was added to the database.

    2. Check permissions on the file savescores.php

    3. Try connecting to the database via phpMyAdmin with the same credentials as in the php scripts, and "manually" inserting one record into the table as described here:

    construct.net/en/tutorials/creating-own-leaderboard-1032/page-2

  • the script does not have any errors, it works on one database, after all.

    i worked around the problem by just using the same database with different tables. not my preferred option but it works.

    thank you for your time :)

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)