02.06.2017, 16:20
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.
Код:
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");
Код:
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; }