Register String - Not sending to database
#1

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.
Reply
#2

still having this problem hmm
Reply
#3

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.
Reply
#4

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]); 
Reply
#5

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.
Reply
#6

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


Forum Jump:


Users browsing this thread: 1 Guest(s)