SA-MP Forums Archive
Register String - Not sending to database - 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: Register String - Not sending to database (/showthread.php?tid=627674)



Register String - Not sending to database - DerickClark - 30.01.2017

I have a problem. i try to set the message to database. when i checked the database it had 0 under personalmsg.


Код:
format(PlayerInfo[playerid][personalmsg], 128, "%s", "The Newcomer");
Код:
        case RegisterDialog:
        {
            if(!response) return Kick(playerid);
            if(strlen(inputtext) < 5)
            {
                SendClientMessage(playerid, -1, "{FF0000}Error: {FFFFFF}Your password must at least contain more than 4 characters.");
                return ShowPlayerDialog(playerid, RegisterDialog, DIALOG_STYLE_INPUT, "Register", "Welcome player!\nYour account has not been registered yet. Please fill in your desired password:", "Register", "Quit");
            }
            new query[512], playerip[16];

            GetPlayerIp(playerid, playerip, sizeof(playerip));
            format(PlayerInfo[playerid][personalmsg], 128, "%s", "The Newcomer");
            WP_Hash(PlayerInfo[playerid][Password], 129, inputtext);
            mysql_format(mysql, query, sizeof(query), "INSERT INTO `accounts` (`Name`, `Password`, `IP`, `personalmsg`, `Admin`, `Money`) VALUES ('%e', '%e', '%e', 0, 0,'%e')", Name[playerid], PlayerInfo[playerid][Password], IP[playerid], PlayerInfo[playerid][personalmsg]);
            mysql_tquery(mysql, query, "OnAccountRegister", "i", playerid);
        }
    }
it saves when they leave.


Re: Register String - Not sending to database - DerickClark - 31.01.2017

still having this problem hmm


Re: Register String - Not sending to database - saffierr - 31.01.2017

Lol because you literally typed '0' yourself to save as personalmsg.
PHP код:
mysql_format(mysqlquerysizeof(query), "INSERT INTO `accounts` (`Name`, `Password`, `IP`, `personalmsg`, `Admin`, `Money`) VALUES ('%e', '%e', '%e', '%e', 0,'%e')"Name[playerid], PlayerInfo[playerid][Password], IP[playerid], PlayerInfo[playerid][personalmsg]); 
try this.

Edit: you're saving Money as '%e' which is wrong, you should use %i.


Respuesta: Register String - Not sending to database - Eloy - 31.01.2017

try this code

PHP код:
mysql_format(mysqlquerysizeof(query), "INSERT INTO `accounts` (`Name`, `Password`, `IP`, `personalmsg`, `Admin`, `Money`) VALUES ('%e', '%e', '%e', '%e', 0,'%d')"Name[playerid], PlayerInfo[playerid][Password], IP[playerid], PlayerInfo[playerid][personalmsg], PlayerInfo[playerid][Money]); 



Re: Respuesta: Register String - Not sending to database - DerickClark - 31.01.2017

Quote:
Originally Posted by Eloy
Посмотреть сообщение
try this code

PHP код:
mysql_format(mysqlquerysizeof(query), "INSERT INTO `accounts` (`Name`, `Password`, `IP`, `personalmsg`, `Admin`, `Money`) VALUES ('%e', '%e', '%e', '%e', 0,'%d')"Name[playerid], PlayerInfo[playerid][Password], IP[playerid], PlayerInfo[playerid][personalmsg], PlayerInfo[playerid][Money]); 
Thank it worked.


Re: Respuesta: Register String - Not sending to database - saffierr - 31.01.2017

Quote:
Originally Posted by DerickClark
Посмотреть сообщение
Thank it worked.
Arghh exactly what I told you...