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



SQLite ID problem - ShadowCoder - 01.12.2018

Okay so when i create new column it writes: ID: 1, when i delete that column and insert new one, it writes ID: 2 WHY? Any solution?? i am using sqlite


Re: SQLite ID problem - Jefff - 01.12.2018

primary key ? auto index id + 1


Re: SQLite ID problem - ShadowCoder - 01.12.2018

nope didn't set it


Re: SQLite ID problem - Jefff - 01.12.2018

Show create table and how you adding id


Re: SQLite ID problem - ShadowCoder - 01.12.2018

Код HTML:
db_query(Database, "CREATE TABLE IF NOT EXISTS `Reports` (`ID`, `Reporter`, `Target`, `Reason`, `Timestamp`)");
Код HTML:
format(Query, sizeof(Query), "INSERT INTO `Reports` (`ID`, `Reporter`, `Target`, `Reason`, `Timestamp`) VALUES('%i', '%s','%s','%s','%s')", db_get_field_int(Result), DB_Escape(GetName(playerid)), DB_Escape(GetName(target)), DB_Escape(reason), DB_Escape(timestamp));



Re: SQLite ID problem - Jefff - 01.12.2018

but where is `ID` INTEGER etc? what is this db_get_field_int(Result) ? format supports escape strings, you dont need DB_Escape anymore, replace '%s' to '%q'