MYSQL not insert (frag.gs)
#1

Anyone could help me to find where is the problem?

I have this register system:
Code:
if(dialogid == DIALOG_REGISTER) {
    if(!response) return Kick(playerid);
    if(response) {
        if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, "Please enter a valid password!", "Please enter a valid registration password\nTo continue press Register\n\nOxiRegister 1.0\n", "Register", "Quit");
        else {
			new vidainicial = 100;
			new skininicial = 7;
			SetPlayerSkin(playerid, skininicial);
            SHA256_PassHash(inputtext, HASH_SENHA, pInfo[playerid][pSenha], 64);
            GetPlayerIp(playerid, ip, sizeof(ip));
			format(query, sizeof(query), "INSERT INTO `accounts` (`Username`, `Senha`, `IP`, `hp`, `playerlskin`) VALUES ('%s', '%s', '%s', '%i', '%i')"
				, GetName(playerid), pInfo[playerid][pSenha], ip, vidainicial, skininicial);
			mysql_query(ConnectMYSQL,query);
            pInfo[playerid][Registered] = true;
            pInfo[playerid][LoggedIn] = true;
            Logado[playerid] = 1;
			SendClientMessage(playerid, COLOR_GREY, "Conta registrada!");
            cache_get_value_int(0, "UserID", pInfo[playerid][UserID]);
            firstlogin[playerid] = true;
            OnPlayerLogin(playerid);
        }
    }
    return 1;
}
In my house it's work...
But in host of frag.gs is not work...

It's not registering a new account...
The strange is, login(load), logout(save) is working, but it not...

I'm using MySQL plugin R41-2
Reply
#2

Check the value type your column 'hp'. If its Float, change especifier here

PHP Code:
format(querysizeof(query), "INSERT INTO `accounts` (`Username`, `Senha`, `IP`, `hp`, `playerlskin`) VALUES ('%s', '%s', '%s', '%i', '%i')"
                
GetName(playerid), pInfo[playerid][pSenha], ipvidainicialskininicial);
            
mysql_query(ConnectMYSQL,query); 
to

PHP Code:
format(querysizeof(query), "INSERT INTO `accounts` (`Username`, `Senha`, `IP`, `hp`, `playerlskin`) VALUES ('%e', '%s', '%s', '%f', '%i')"
                
GetName(playerid), pInfo[playerid][pSenha], ipvidainicialskininicial);
            
mysql_query(ConnectMYSQL,query); 
Remember

%s = strings
%e = Strings anti injection sql
%f = Point Float
%d = Integer
%i = Ingeger
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)