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=353773)



SQLite problem - Danijel. - 24.06.2012

When i enter this in my SQLite Database browser it just blocks and stop working.


INSERT INTO `HOUSES` ( 'ID', 'NAPRODAJU', 'VLASNIK', 'CIJENA', ADRESA', 'X', 'Y', 'Z', 'INZX', 'INTY', 'INTZ', 'MATS', 'DROGA', 'NOVAC', 'BRAVA', 'INT', 'RENTABIL', 'RENT', 'ALARM')



Where is the problem?


Re: SQLite problem - Jonny5 - 24.06.2012

your giving the table field names but not the values.

INSERT INTO `HOUSES` ( ....)VALUES(...)


Re: SQLite problem - Danijel. - 24.06.2012

Same thing,when i enter something i know it works its all fine, no error.


Re: SQLite problem - Jonny5 - 24.06.2012

it wont give an error if sql syntax is wrong,

post what you changed,

heres how i insert!

pawn Код:
//first i build my values to insert
format
    (
        Query_Values,
        sizeof(Query_Values),
        "'%i','%f','%f','%f','%f','%f','%f'",
        gDBObjs[objectid][E_DB_OBJ_MODEL],
        gDBObjs[objectid][E_DB_OBJ_X],
        gDBObjs[objectid][E_DB_OBJ_Y],
        gDBObjs[objectid][E_DB_OBJ_Z],
        gDBObjs[objectid][E_DB_OBJ_RX],
        gDBObjs[objectid][E_DB_OBJ_RY],
        gDBObjs[objectid][E_DB_OBJ_RZ]
    );
//then i build a query and  append my Values from above to it
    format(Query, sizeof(Query), "INSERT INTO OBJS (`MODEL`,`X`, `Y`, `Z`, `RX`, `RY`, `RZ`) VALUES(%s)", Query_Values);