Online Hiscores

Previous topic - Next topic


Ok, problem solved: I simply forgot to put a "/" in front of the folder...  :S Stupid me, but maybe someone else stumbles across the same problem someday.

Hello everybody,

I am very happy to tell you that I just bought a license for GLBasic (thank you Gernot for providing the code instantaneously!)  :good:

Now I wanted to experiment with the NETWEBGET command, especially with an online hiscore function for my breakout clone.

Problem ist: I just don't understand how to insert data into my MySql database via the GLBasic program. The database is all set up, and the php-files for saving and loading data are working as well (when i manually enter the URL into my browser the data gets saved in the database).

Now my question is: How can I save the hiscore data from within the GLBasic program? I tried it like that and it doesn't work:

Code (glbasic) Select
NETWEBGET("", "myFolder/myscript.php?game=MyGame&name=" + pl$ + "&score=" + score + "&level=" + level, 80, 99999)

What am I doing wrong? Do I have to use NETWEBEND instead? But then everyone would see the URL...?

Thank you!
ILI-Blocks, my first game ever - please check it out!


The MySQL database needs to be updated from the php script not from GLBasic. You are passing the parameter to your php script and using GET in php to grab the passed parameters, but it is this data from within php that you need to perform the MySQL commands to INSERT into your database. |

Comps Owned - ZX.81, ZX.48K, ZX.128K+2, Vic20, C64, Atari-ST, A500.600.1200, PC, Apple Mini-Mac.


Hi Poetronic, welcome!!! you are in your Home...

About this you comment, I think in the forum, have a library for sql... I´m not sure if can works or you, I don´t tray naver, because I don´t know too much about networks commands...



Thx guys for your replies!

Everything is working just fine now. I had already set up a MySql-database plus the necessary PHP-scripts. The problem was that I forgot to place a slash in the NETWEBGET command referring to the folder where the php-files are stored on my webspace. The lesson: More often than not it is the small things that make a hobby-programmers life a bit more difficult.

So again, for people who read this thread looking for a short explanation on how to make use of online hiscores:

1. Set up an online Database (i.e. MySql).
2. Set up a script (I used PHP) that reads variables from a URL and writes them into your database (i.e. using the $_GET-function)
3. In your GLBasic program, make use of the NETWEBGET command to refer to your PHP-scripts:

Code (glbasic) Select
test$ = NETWEBGET$("", "/myFolder/myscript.php?game=MyGame&name=" + pl$ + "&score=" + score + "&level=" + level, 80, 0, 99999)

This command will open the file with some variables from within your program (this is the stuff that comes after the "?" in the link, in this case the player's name, the score and the current level). The php-functions in the file will then read the variables from the link - i.e. making use of the GET_$ command - without opening a browser window and write them into your database.

The variable test$ stores the content of the URL in your program; 80 refers to the port used; 0 is the maximum length of the $test-variable; and 99999 is the timeout for the request (in milliseconds I assume).

I hope that this explanation is more correct than not. Please let me know if I am somehow mistaken about how the NETWEBGET command is supposed to be used.

Thank you!


ILI-Blocks, my first game ever - please check it out!