SQLite Problems.
#1

Hello, I am here because I am doing my server with SQLite and I cannot insert data in the database.
I leave you the code with which I try to insert data
Code:
case DIALOG_REGISTER:
		{
		 if (!response) return Kick(playerid);

         if (!(3 <= strlen(inputtext) <= 20))
         {
         SendClientMessage(playerid,-1,"[ERROR]: Tu clave debe tener entre 3 y 20 caracteres.");
         ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, "Registrate", "No hay cuentas con este nombre creadas\nEscribe una clave para tu cuenta","Continuar","");
		 return 1;
		 }
		 new str[256], DBResult:Result;
		 new PName[MAX_PLAYER_NAME];
		 GetPlayerName(playerid, PName, sizeof PName);
		 WP_Hash(AccountInfo[playerid][cPassword], 129, inputtext);
		 format(str, sizeof str, "INSERT INTO Usuarios (Nombre, Password) VALUES ('%q', '%s')", PName, AccountInfo[playerid][cPassword]);
		 db_query(db1,str);
		 
		 SendClientMessage(playerid,-1,"Felicidades! te acabas de registrar en el servidor");
		 Result = db_query(db1, "SELECT last_insert_rowid()");
		 AccountInfo[playerid][cID] = db_get_field_int(Result);
		 db_free_result(Result);
		 
		}
I don't think the problem is with the method I use, plus the compiler doesn't give errors.
Reply
#2

Was database opened correctly? You can enable:
pawn Code:
db_logging 1
option in server.cfg
Reply
#3

Ty, it is working now. There was a space after the name of a column and i hadnґt noticed.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)