Autoincrement - 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: Autoincrement (
/showthread.php?tid=480719)
Autoincrement -
Mattakil - 12.12.2013
I want to have the ID field auto increment, but when I do it in CREATE TABLE (sqlite), the ID field dont show in the database?
pawn Код:
"CREATE TABLE IF NOT EXISTS `ACCOUNTS` (`ID int(11) PRIMARY KEY AUTOINCREMENT`)");
Re: Autoincrement -
Roel - 12.12.2013
Код:
CREATE TABLE IF NOT EXISTS `accounts` (
`ID` int(11) NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
Re: Autoincrement -
Mattakil - 14.12.2013
That didn't work. Here is my whole Create Table
Код:
"CREATE TABLE IF NOT EXISTS `ACCOUNTS` (`IP`, `PASSWORD`, `CASH`, `NAME`, `ADMIN`, `DEV`, `HELPER`, `VIP`, `LEVEL`, `XPOS`, `YPOS`, `ZPOS`, `NUMBER`, `PTIME`, `BANNED`, `SEX`, `TUT`, `FACTION`, `FACLEVEL`, `FACRANK`, `PAYCHECK`, `PAYDAY`, `HOURS`, `JAILED`, `MASK`, `JOB`, `LICENSE`, `CARKEY`, `CARKEY2`, `CARKEY3`, `GUNLICENSE`, `ARRESTED`, `WALKIE`, `BANREASON`, `GASCAN`, `ID` int(11) NOT NULL AUTO_INCREMENT, `BANADMIN`, `BANDATE`, `SKIN`)");
Re: Autoincrement -
arakuta - 14.12.2013
Did you ever minded that CREATE TABLE IF NOT EXISTS will only be executed when the table do not exists?
So, delete it and try again. Or in PhpMyAdmin you can just go to You Database > Your Table > Structure > Click in edit in the ID field, and make sure that A_I box is checked.
Re: Autoincrement - Emmet_ - 14.12.2013
For SQLite, do this:
pawn Код:
CREATE TABLE IF NOT EXISTS `ACCOUNTS` (`ID` INTEGER PRIMARY KEY AUTOINCREMENT)