SA-MP Forums Archive
SQLite won't insert into - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: SQLite won't insert into (/showthread.php?tid=665634)



SQLite won't insert into - Unkovic - 11.04.2019

PHP Code:
format(sqlquerysizeof(sqlquery), "INSERT INTO `players` (`Name`, `Password`, `Salt`, `Pol`, `Godine`, `Email`) VALUES ('%s', '%s', '%s', %d, %d)"
                
DB_Escape(E_PLAYER_INFO[playerid][E_PLAYER_NAME]), 
                
DB_Escape(E_PLAYER_INFO[playerid][E_PLAYER_PASSWORD]), 
                
DB_Escape(E_PLAYER_INFO[playerid][E_PLAYER_SALT]), 
                
E_PLAYER_INFO[playerid][E_PLAYER_GENDER], 
                
E_PLAYER_INFO[playerid][E_PLAYER_AGE]);
            
            
db_query(Databasesqlquery);
print(
sqlquery); 
It won't Insert data into database
.
//print(sqlquery); this outputs
PHP Code:
INSERT INTO `players` (`Name`, `Password`, `Salt`, `Pol`, `Godine`, `Email`) VALUES ('Stefa_Kuja''F8FAE6659CF55CFDF7E3FEA6A3DC12C4E488F102725FC16990A57657CED954A7'')ufaKWYP?[tz.0YU'118



Re: SQLite won't insert into - IdonTmiss - 11.04.2019

Try chaning this
pawn Code:
VALUES ('%s', '%s', '%s', %d, %d) // TO

VALUES ('%s', '%s', '%s', '%d', '%d')
EDIT: Also I don't know much about SQLite but does it have logs if so can u send them


Re: SQLite won't insert into - khRamin78 - 12.04.2019

if you can give us log errors next time (Main File > Logs > Errors)

anyway for this one there is one missing in your format!

(`Name`, `Password`, `Salt`, `Pol`, `Godine`, `Email`)
('%s', '%s', '%s', %d, %d)

you dident specife any detecter for Email Value!
remove it or make it like this !
('%s', '%s', '%s', %d, %d,'%s')
and add playeremail at end of format


Re: SQLite won't insert into - Unkovic - 13.04.2019

Quote:
Originally Posted by IdonTmiss
View Post
Try chaning this
pawn Code:
VALUES ('%s', '%s', '%s', %d, %d) // TO

VALUES ('%s', '%s', '%s', '%d', '%d')
EDIT: Also I don't know much about SQLite but does it have logs if so can u send them
Quote:
Originally Posted by khRamin78
View Post
if you can give us log errors next time (Main File > Logs > Errors)

anyway for this one there is one missing in your format!

(`Name`, `Password`, `Salt`, `Pol`, `Godine`, `Email`)
('%s', '%s', '%s', %d, %d)

you dident specife any detecter for Email Value!
remove it or make it like this !
('%s', '%s', '%s', %d, %d,'%s')
and add playeremail at end of format
I just have removed Email so it now looks like this
PHP Code:
format(sqlquerysizeof(sqlquery), "INSERT INTO `players` (`Name`, `Password`, `Salt`, `Pol`, `Godine`) VALUES ('%s', '%s', '%s', %d, %d)"
                
DB_Escape(E_PLAYER_INFO[playerid][E_PLAYER_NAME]), 
                
DB_Escape(E_PLAYER_INFO[playerid][E_PLAYER_PASSWORD]), 
                
DB_Escape(E_PLAYER_INFO[playerid][E_PLAYER_SALT]), 
                
E_PLAYER_INFO[playerid][E_PLAYER_GENDER], 
                
E_PLAYER_INFO[playerid][E_PLAYER_AGE]);
            
            
db_query(Databasesqlquery); 
It didn't give me any error in logs > errors. It is blank. Do I Need to put any function after db query?