SA-MP Forums

Go Back   SA-MP Forums > SA-MP Server > Server Support

Reply
 
Thread Tools Display Modes
Old 28/05/2020, 02:45 AM   #1
FedericoCacace
Little Clucker
 
Join Date: Oct 2018
Location: Argentina
Posts: 7
Reputation: 0
Default SQLite Problems.

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.
FedericoCacace is offline   Reply With Quote
Old 28/05/2020, 04:08 PM   #2
Calisthenics
High-roller
 
Join Date: May 2018
Posts: 1,228
Reputation: 205
Default Re: SQLite Problems.

Was database opened correctly? You can enable:
pawn Code:
db_logging 1
option in server.cfg
__________________
Calisthenics is offline   Reply With Quote
Old 28/05/2020, 05:05 PM   #3
FedericoCacace
Little Clucker
 
Join Date: Oct 2018
Location: Argentina
Posts: 7
Reputation: 0
Default Re: SQLite Problems.

Ty, it is working now. There was a space after the name of a column and i hadnīt noticed.
FedericoCacace is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
SQLite Problems preda98 Scripting Help 11 24/08/2012 10:12 AM
SQLite 2 problems... Edvin Help Archive 2 04/07/2011 08:20 PM
SQLite Problems Anwix Help Archive 0 14/02/2010 09:25 PM
SQLite DB problems MX_Master Help Archive 3 08/03/2009 05:28 PM


All times are GMT. The time now is 02:18 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.