MySQL - 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 (
/showthread.php?tid=507948)
MySQL -
austin070 - 19.04.2014
pawn Код:
case DIALOG_REGISTER:
{
if(!response) return Kick(playerid);
new query[256], password[50];
mysql_real_escape_string(inputtext, password);
format(query, sizeof(query), "INSERT INTO `users` (`username`, `password`, `money`, `skin`) VALUES (`%s`, `%s`, `%d`, `%d`)", GetPName(playerid), password, 10000, 23);
mysql_query(query);
new str[128];
format(str, sizeof(str), "(INFO){FFFFFF} You have successfully registered the name '%s.'", GetPName(playerid));
SendClientMessage(playerid, COLOR_YELLOW, str);
SendClientMessage(playerid, COLOR_YELLOW, "(INFO){FFFFFF} Enjoy your stay!");
}
Why doesn't this update the table?
Re: MySQL -
itsCody - 19.04.2014
pawn Код:
format(query, sizeof(query), "INSERT INTO `users` (`username`, `password`, `money`, `skin`) VALUES ('%s', '%s', '%i', '%d')", GetPName(playerid), password, 10000, 23);
you can try that but don't use ` for values, use '
Re: MySQL -
austin070 - 19.04.2014
Quote:
Originally Posted by itsCody
pawn Код:
format(query, sizeof(query), "INSERT INTO `users` (`username`, `password`, `money`, `skin`) VALUES ('%s', '%s', '%i', '%d')", GetPName(playerid), password, 10000, 23);
you can try that but don't use ` for values, use '
|
thank you
Re: MySQL -
DobbysGamertag - 20.04.2014
To make this a tad more efficient, why don't you make the queries threaded? Or make the query shorter by using default values. I only save the password and username on registering. I've assigned default values in the tables.
pawn Код:
#define THREAD_ADD_USER 1
//some callback.
format(query,sizeof(query),"...");
mysql_query(query,THREAD_ADD_USER,playerid);
//somewhere in your script.
public OnQueryFinish(query[], resultid, extraid, connectionHandle)
{
switch(resultid)
{
case THREAD_ADD_USER:
{
//code
}
}
return 1;
}
Or maybe upgrade to R38? Just a tip