Jump to content


Photo

Gmsql 1.0


  • This topic is locked This topic is locked
547 replies to this topic

#41 Oxymen

Oxymen

    GMC Member

  • New Member
  • 23 posts

Posted 17 April 2004 - 06:46 PM

Can someone send me or upload the 5.0 version? I cant donwload it..
  • 0

#42 Guest_Mafiaboy69_*

Guest_Mafiaboy69_*
  • Guests

Posted 18 April 2004 - 09:18 AM

why dont you just get 5.3 it's better :)


ooohh your not registerd :lol: well i had the same problem last year to. i coudn't pay because my parents wont let me buy stuff over the internet. but since mark lives in the Nederlands and I in Belgium i can still sue him if he miss use my personal information my parents dont trust anyone unless they have seen the persone face to face.

last year december i got registerd and i'm still enjoying GM Full version 5.3 so get registerd you wont feel sorry :D ^_^ :P just keep on asking for it, if your parents ask you what you want to eat just say Game Maker registerd, if they ask you are you all right just say if i get Game Maker registerd they i will etc... just keep on talking about it. i worked for me and i got it for kristmas

#43 databot

databot

    admin of moonlight games

  • New Member
  • 309 posts

Posted 18 April 2004 - 10:05 AM

if your parents ask you what you want to eat just say Game Maker registerd, if they ask you are you all right just say if i get Game Maker registerd they i will etc... just keep on talking about it. i worked for me and i got it for kristmas

i just kept leaving notes every where asking them to register gamemaker.
lets see now, ah yes i used:
post it notes
microsoft agent at the start up of windows
e-mails
texts
phone calls
  • 0

#44 Bami

Bami

    StupideGames

  • New Member
  • 389 posts
  • Version:GM5

Posted 18 April 2004 - 10:46 AM

sweet program smarty, only one thing: my PC hangs when I try to connect

I've created an MySQL server and here are the stats:

www.freesql.org
username : gunhappy
password : online

I have an firewall built in to my router so i cant shut it off to test it. do you have any problems like that or can anyone test it for me?

EDIT : thanx PromaneX

Edited by stupidegames, 18 April 2004 - 12:02 PM.

  • 0

#45 GBStew

GBStew

    GMC Member

  • New Member
  • 21 posts

Posted 18 April 2004 - 11:56 AM

THANK YOU!!! THANK YOU!!! This will be so useful for my online projects!
  • 0

#46 PromaneX

PromaneX

    Fixer of broken web things

  • New Member
  • 489 posts

Posted 18 April 2004 - 11:58 AM

Looks like a lot of you are having problems gaining proper use of a MySql database , i know a solution for testing puroses you can get the free windows based MySql sever and use that , i recomend you get phpdev4 from http://firepages.com.au cos it comes with phpmyadmin to help you administer your database ^_^

edit get mysql from the official site (large file for some reson) http://dev.mysql.com...om/pick#mirrors

i still recomend phpdev4

Edited by PromaneX, 18 April 2004 - 01:05 PM.

  • 0

#47 Smarty

Smarty

    GMC Member

  • Retired Staff
  • 7228 posts
  • Version:GM:Studio

Posted 18 April 2004 - 12:20 PM

sweet program smarty, only one thing: my PC hangs when I try to connect

I've created an MySQL server and here are the stats:

www.freesql.org
username : gunhappy
password : online

I have an firewall built in to my router so i cant shut it off to test it. do you have any problems like that or can anyone test it for me?


I have been able to log on.

The problem is the initial connection (gmsql_connect). For some reason I can't figure out, this takes several seconds to complete, about 10-15 here. Your system may seem to hang, but it's actually busy building the connection. After that, queries run comparatively fast.

I don't know what causes the initial slow connection. I think it has to do something with server-side settings, but as I am no MySQL crack I don't know how to fine-tune these. AFAIK in the DLL code there is nothing I can do about it, I'm just using the required functions for it.

If anyone knows why this may happen, I'd be interested to know (and will put it in the documentation). I have the idea that the MySQL server is busy finding the right communication platform (MySQL server may run on a completely different platform) with the currently connected machine. On a local PC it takes no significant time at all.

Smarty
  • 0

#48 bobby2guns2003

bobby2guns2003

    Whateva!

  • New Member
  • 149 posts

Posted 21 April 2004 - 03:17 AM

Is it possible to use This to connected to a mysql data base with something like phpnuke or woops or a home made thing or any mysql "installment" on it then load and save in the user folder ( same spot the "installment" loads its users from) cas if you could do something like this it would be easyer to make a system were you could have p2p players and people could edit there acounts ( change passwords and create acounts online.)
  • 0

#49 Gogeta

Gogeta

    GMC Member

  • New Member
  • 5 posts

Posted 21 April 2004 - 04:23 AM

You could, it has full MySQL syntax compatibility :) It would be the same as doing it from a web page in PHP, only the functions are called from GM.
  • 0

#50 Guest_Paulbreeuwsma_*

Guest_Paulbreeuwsma_*
  • Guests

Posted 04 May 2004 - 10:59 AM

How can I save the ip adres in a mysql database?
I can't use the function mplay_ipaddress() to read the ip, because if you have a LAN network that function returns the LAN ip(in my case 192.168.1.2) and not the WAN ip.

#51 Smarty

Smarty

    GMC Member

  • Retired Staff
  • 7228 posts
  • Version:GM:Studio

Posted 04 May 2004 - 12:06 PM

I'm not sure, maybe the MySQL server has a variable that contains the IP address of the connected client within the session. Haven't found anything on that yet, though.

Smarty
  • 0

#52 Oxymen

Oxymen

    GMC Member

  • New Member
  • 23 posts

Posted 04 May 2004 - 12:42 PM

Ok, can smart or anybody else, please make an example or explan with code how to just send some info to the database and retrieve it?
  • 0

#53 Smarty

Smarty

    GMC Member

  • Retired Staff
  • 7228 posts
  • Version:GM:Studio

Posted 04 May 2004 - 02:06 PM

Ok, can smart or anybody else, please make an example or explan with code how to just send some info to the database and retrieve it?


I think the manual I wrote explains that pretty well... Either that, or you may want to read the MySQL manual first.

Smarty
  • 0

#54 Guest_Paulbreeuwsma_*

Guest_Paulbreeuwsma_*
  • Guests

Posted 04 May 2004 - 02:37 PM

I'm not sure, maybe the MySQL server has a variable that contains the IP address of the connected client within the session. Haven't found anything on that yet, though.

Smarty

I can't find a variable! ^_^:unsure:^_^

#55 Guest_Trixer_*

Guest_Trixer_*
  • Guests

Posted 15 May 2004 - 03:42 PM

global.logon=false;

username=wgmGetText(global.username);
password=wgmGetText(global.password);

if !gmsql_connect('www.blacknova.servegame.com','username','password','trixer_darkfusion'){
   show_message('Failed to connect to database server.');
   exit;
  }
  gmsql_selectdb("trixer_darkfusion");
  
  if gmsql_query('select * from players where user="username" and pass="password"') {
  show_message("Logged in");
  show_message(username);
  global.logon=true;
  }
  else {
  show_message("failed to login check username or password");
  }
  
   
  if !gmsql_storeresult()
  {
  show_message("failed to get player data");
  }

This script should scan the database for a place where the username and password match and then save it. if not it should give them a message saying there stuff wasnt right.. though for some reason it works all the time (even when tested for users that dont exist or what ever else) and when Im not to sure the gmsql_stroreresults is running because all I pull is blank strings out of it...

#56 Guest_Trixer_*

Guest_Trixer_*
  • Guests

Posted 15 May 2004 - 04:27 PM

I'm not sure, maybe the MySQL server has a variable that contains the IP address of the connected client within the session. Haven't found anything on that yet, though.

Smarty 


I can't find a variable! 


There is a mplay function that gets the users IP save it as a varable then insert it......

Edited by Trixer, 15 May 2004 - 04:30 PM.


#57 Smarty

Smarty

    GMC Member

  • Retired Staff
  • 7228 posts
  • Version:GM:Studio

Posted 16 May 2004 - 01:53 PM

This script should scan the database for a place where the username and password match and then save it. if not it should give them a message saying there stuff wasnt right.. though for some reason it works all the time (even when tested for users that dont exist or what ever else) and when Im not to sure the gmsql_stroreresults is running because all I pull is blank strings out of it...


Since you do not get a warning at the database logon, I assume that the username and password used are correct. However, this part is incorrect for two reasons:

if gmsql_query('select * from players where user="username" and pass="password"') {
 show_message("Logged in");
 show_message(username);
 global.logon=true;
 }

1)
As Erik said in your topic in Advaced, it will look for "username" and "password" in the table "players", but it does not actually fill in the values of those variables into the query.

It's easier to think what would be your original query. Let's say that username contains "Trixer", and password contains "beer". The query that the MySQL server needs to receive is this:

select * from players where user="Trixer" and pass="beer"

As you can see you need quotes around Trixer and beer, because they are text strings. But a string in GML also contains quotes. This means you have to place quotes INSIDE the quoted strings in GML. For the GML language you use single quotes, and for the query you use double quotes. Then you carefully add the whole piece together:

gmsql_query('select * from players where user="'+username+'" and pass="'+password+'"');

This of course works only if the table contains fields called "user" and "pass". You should notice that the last characters are a single quote, a double quote, and a single quote again after one another. Difficult to read, isn't it?

2)
Using if gmsql_query... et cetera, checks whether the query succeeded. The query however can succeed without having any results. You assume it only succeeds when it finds the record, but it succeeds usually only because the query syntax is OK - and it indeed was OK when you entered it, although it didn't contain a username and password that were in your table.

So to see whether the player exists in the database, you need to check how many records where found that contain this username and password. You need to load the record first, otherwise you will never know what is returned.

Your correct syntax would be this:

if !gmsql_query('select * from players where user="'+username+'" and pass="'+password+'"')
   {
     show_message('Query failed');
     exit;
    }

if !gmsql_storeresult()
 {
 show_message('failed to get result data');
 exit;
 }

if gmsql_numrows()<>1
  {
    show_message('Failed to log on due to incorrect username and/or password.');
    exit;
  }
global.logon=true;

I have a likewise example in my manual that just tries to load the record immediately and then checks the password for itself instead of querying it from the database. This way you can also check whether either the password is wrong, or the username.

There is a mplay function that gets the users IP save it as a varable then insert it......


The function mplay_ipaddress() returns the local IP, but in some cases where you have both a LAN IP and an Internet IP, it usually only returns the LAN IP, which is of no use. The MySQL server should always know the correct IP, but I haven't found a method yet to get that information from the server.

Anyway, since dynamic IPs are still around, I don't see much use to store IP addresses other than for logging purposes.

Smarty
  • 0

#58 Avalanche

Avalanche

    http://assassin.fight.at

  • New Member
  • 90 posts

Posted 06 June 2004 - 10:48 PM

I am having problems. Here is my creation code:

{

    if (!gmsql_init()) {
     show_message(gmsql_errormessage());
     exit;
    }
    
    if(!gmsql_connect("localhost","root","","rpg")) {
     show_message(gmsql_errormessage());
     exit;
    }
    
    if(!gmsql_query("SELECT * FROM settings WHERE name='up'")) {
     show_message(gmsql_errormessage());
     exit;
    }
    
    if(!gmsql_useresult()) {
     show_message(gmsql_errormessage());
     exit;
    }
    
 up = gmsql_getvalue(2);
    
}

And here is my enter key release event:

{

 var user, pass;

    if(up == "true") {
     user = get_string("What do you wish your username to be?","");
     pass = get_string("What do you wish your password to be?","");
     
        if(user == "" || pass == "") {
         show_message("Please enter a valid username and password.");
         exit;
        }
        
        if(!gmsql_query("SELECT * FROM users WHERE username='"+user+"')) {
         scr_displayerror("Getting user error");
         exit;
        }
        
        if(!gmsql_storeresult()) {
         scr_displayerror("Storing result error");
         exit;
        }
        
        if(gmsql_numrows() > 0) {
         show_message("That username is already taken. Please choose a different username.");
         exit;
        }
        
     gmsql_query("INSERT INTO users VALUES('','"+user+"',password("+pass+"))");
     
     show_message("You should now be registered.");
    }

}

I keep getting: "Getting user error: 'Commands out of sync; You can't run this command now' Error code: 2014"

I have looked it up and it says it could come from using mysql_store_result or mysql_get_result and not using mysql_free_result to free the space up. I don't believe there is a gmsql_freeresult function.

Edited by Avalanche, 06 June 2004 - 10:51 PM.

  • 0

#59 Smarty

Smarty

    GMC Member

  • Retired Staff
  • 7228 posts
  • Version:GM:Studio

Posted 06 June 2004 - 11:30 PM

I have looked it up and it says it could come from using mysql_store_result or mysql_get_result and not using mysql_free_result to free the space up. I don't believe there is a gmsql_freeresult function.


That is correct. I am taking care of that in my DLL, since I only allow for one result table to be stored anyway and to make it easier for the users.

I am not sure how this error can occur though. Could you find out at which command the error occurs exactly?

To find this out properly, try displaying the error message after just about any GMSQL command.

Smarty
  • 0

#60 Avalanche

Avalanche

    http://assassin.fight.at

  • New Member
  • 90 posts

Posted 07 June 2004 - 12:26 AM

Well, I figured out how to fix it. I run this script after every query that returns results:

{

 gmsql_dataseek(0);
 gmsql_fetchrow(0);
 
}

  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users