Quantcast
Channel: SA-MP Forums
Viewing all articles
Browse latest Browse all 18226

mySQL error

$
0
0
I have this code to register a new user, it creates the table perfectly, but when it has to insert the values, it doesn't insert them. I don't know why.

Code:

mysql_query("CREATE TABLE IF NOT EXISTS Usuarios (Id_User INT(5) NOT NULL AUTO_INCREMENT, NombreRP VARCHAR(34) NOT NULL, Contraseña VARCHAR(34) NOT NULL, PRIMARY KEY (Id_User))");
        mysql_query("ALTER TABLE Usuarios ADD Admin INT(5) NOT NULL");
        mysql_query("ALTER TABLE Usuarios ADD Cartera INT(5) NOT NULL");
        mysql_query("ALTER TABLE Usuarios ADD Edad INT(5) NOT NULL");
        mysql_query("ALTER TABLE Usuarios ADD Sexo INT(5) NOT NULL");

Code:

stock Register(playerid, password[])
{
        if(AccountExists[playerid])
                return SendClientMessage(playerid, COLOR_RED, "[Account] You're registered!");

        if(PlayerLogged[playerid])
                return SendClientMessage(playerid, COLOR_RED, "[Account] You're logged in!");

        CheckMySQL();

        new Insertar[256];
        format(Insertar, 256, "INSERT INTO usuarios (NombreRP, Contraseña, Admin, Cartera, Edad, Sexo) VALUES ('%s', '%s', '0', '0', '0', '0')", PlayerInfo[playerid][NombreRP], password);
        mysql_query(Insertar);

    AccountExists[playerid] = 1;
        SendClientMessage(playerid, COLOR_YELLOW, "[Account] Your account has been created!");

        return 1;
}


Viewing all articles
Browse latest Browse all 18226

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>