SA-MP Forums Archive
Mysql help needed ! fast :( - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Mysql help needed ! fast :( (/showthread.php?tid=420663)



Mysql help needed ! fast :( - Hade. - 06.03.2013

Hey, so im a scripter of a RP server with mysql, i got the gamemode, installed the plugin but i get 25 of these errors.

Код:
C:\Users\Ilmar\Desktop\GM\gamemodes\downtown.pwn(2704) : error 017: undefined symbol "mysql_query"
Really need help, dont know what to do.


Re: Mysql help needed ! fast :( - shady001 - 06.03.2013

if you are using mysql version r7 of BlueG the new comand is mysql_function_query , not mysql_query !

Here is a tutorial: https://sampforum.blast.hk/showthread.php?tid=337810


pawn Код:
mysql_function_query(dbHandle, "SELECT ... FROM ...", true, "OnQueryFinished", "siii", "Andre", 1, 2, 3);
forward OnQueryFinished(name[], number_1, number_2, number_3);
public OnQueryFinished(name[], number_1, number_2, number_3)
{
    printf("Data: %s %i %i %i", name, number_1, number_2, number_3);
    // will print: Andre 1 2 3
}
But you can use this to:

pawn Код:
mysql_function_query(dbHandle, "SELECT ... FROM ...", true, "", "");
If you don't want something to be executed after mysql query or to send data etc ... i recomand you that tutorial


Re: Mysql help needed ! fast :( - Hade. - 06.03.2013

i dont understand, what do i write then ?


Re: Mysql help needed ! fast :( - RajatPawar - 06.03.2013

With mysql_function_query, you can use the callback parameter. It means, the callback YOU HAVE SPECIFIED will be called as the query will be executed! So you can do awesome things with it.
pawn Код:
mysql_function_query("SELECT ... FROM ...", true, "OnQueryFinished", "s", "Some string parameter");
pawn Код:
forward OnQueryFinished(somestring[]);
public OnQueryFinished(somestring[])
{
    printf("Data: %s", somestring);
return 1;
}
This should print "Some string parameter".


Re: Mysql help needed ! fast :( - Hade. - 06.03.2013

But i have the querry like this..

mysql_query(query);

Really, i dont understand anything right now ...


Re: Mysql help needed ! fast :( - RajatPawar - 06.03.2013

So just use it like this!
pawn Код:
mysql_function_query(query, true, "", "");