13.11.2012, 19:28
(
Последний раз редактировалось Ballu Miaa; 14.11.2012 в 06:37.
)
Create the database and set the part as AUTO_INCREMENT which you want to increment everytime some data is inserted into the fields.
Example of creating a database via pawn:
Now on INSERT INTO part you do not need to insert in 'id' field with this type of code.
pawn Код:
`id` int(20) NOT NULL AUTO_INCREMENT
pawn Код:
format(query,sizeof(query),"CREATE TABLE IF NOT EXISTS `Business`(`id` int(20) NOT NULL AUTO_INCREMENT,`owner` varchar(26) DEFAULT NULL,`bname` varchar(40) DEFAULT NULL,`x` float(20) DEFAULT NULL,`y` float(20) DEFAULT NULL,`z` float(20) DEFAULT NULL,");
strcat(query,"`world` int(10) DEFAULT NULL,`interior` int(10) DEFAULT NULL,`entangle` float(20) DEFAULT NULL,`exangle` float(20) DEFAULT NULL,`locked` int(5) DEFAULT NULL,`price` int(30) DEFAULT NULL,`forsale` int(5) DEFAULT NULL,`cash` int(15) DEFAULT NULL,");
strcat(query,"`stock` int(10) DEFAULT NULL,`time` int(20) DEFAULT NULL,PRIMARY KEY (`id`))");
mysql_query(query);