SA-MP Forums Archive
sqlite problem - 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 problem (/showthread.php?tid=544937)



sqlite problem - Cerealguy - 05.11.2014

Hello, I'm making a record in sqlite, I connect to the server all good, when reviewing the db to see if I insert data there is nothing

pawn Код:
stock ReturnPlayerName(playerid)
{
    new pname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, pname, MAX_PLAYER_NAME);
    return pname;
}
#define GetPlayerName(%0)   ReturnPlayerName(%0)



new
        Query[ 256 ], // Creating a big array this time. No lies :X
    plrIP[ 16 ], // Create a IP string
        buf[129]
    ;

//THIS IS A DIALOG
WP_Hash(buf, 129, inputtext);
format(Query, sizeof(Query), "INSERT INTO `Users` (`Username`, `Password`, `IP`, ) VALUES('%s', '%s', '%s')", DB_Escape(GetPlayerName(playerid)), DB_Escape(buf), DB_Escape(plrIP));
db_query(Database, Query);



Re: sqlite problem - Eth - 05.11.2014

try this:
pawn Код:
WP_Hash(buf, 129, inputtext);
format(Query, sizeof(Query), "INSERT INTO `Users` (`Username`, `Password`, `IP`) VALUES('%s', '%s', '%s')", DB_Escape(GetPlayerName(playerid)), DB_Escape(buf), DB_Escape(plrIP));
db_query(Database, Query);



Respuesta: sqlite problem - Cerealguy - 05.11.2014

same bro, nothing S:


Re: sqlite problem - Pottus - 05.11.2014

Get SQLitei and enable error checking.
https://sampforum.blast.hk/showthread.php?tid=303682

Requires AMX assembly library
https://github.com/Zeex/amx_assembly

Put this into your gamemode

pawn Код:
#define DB_QUERY_ERRORS true
#include <sqlitei>
I almost forgot to mention error checking only works in Windows.


Respuesta: sqlite problem - Cerealguy - 05.11.2014

The query works fine if executed in sqlite

INSERT INTO `Users` (`Username`, `Password`, `IP`) VALUES('0', '0', '0')


Re: sqlite problem - Pottus - 05.11.2014

Like I said dude, use the error checking.


Respuesta: sqlite problem - Cerealguy - 05.11.2014

bro, fatal error 111: user error: amx_assembly is required for DB_QUERY_ERRORS. Get it here: github.com/zeex/amx_assembly

i download this and put on include file


Re: sqlite problem - Pottus - 05.11.2014

It should be in your common includes a_samp etc like this

include\amx_assembly


Respuesta: sqlite problem - Cerealguy - 05.11.2014

bro, my gm http://pastebin.com/Jkh7Ut56


Respuesta: sqlite problem - Cerealguy - 05.11.2014

small bump!