I have trouble building the AUTO INCREMENT column
$connect->query("CREATE TABLE `users` (
`id` int NOT NULL AUTO_INCREMENT,
`userid` int PRIMARY KEY,
`step` varchar(50) DEFAULT NULL,
`member` int DEFAULT '0',
`inviter` int DEFAULT '0',
`coin` int NOT NULL,
`data` TEXT DEFAULT NULL,
`ds` varchar(20) DEFAULT 'ثبت نشده!',
`ts` varchar(20) DEFAULT 'ثبت نشده!',
`lottery` int DEFAULT '0'
) default charset = utf8mb4;");
what this problem?
CodePudding user response:
An auto_increment must be a primary key, and you're trying to add user_id
as primary key as well. It won't work, your id
should be primary key auto_increment
and your user_id
should be a foreign key not primary key anymore.