0

I am using laravel 5.2 to develop my web application. i recently uploaded the web application from localhost to my hosting account. I also imported MySQL tables from phpmyadmin localhost to my phpmyadmin localhost in my hosting account.

When I opened my phpmyadmin I noticed that in one of my tables, the id (which is set to auto-increment) is not working. It is displaying 0 in all the rows.

When I set the id to auto-increment in phpmyadmin it gives me the following error:

#1075 - Incorrect table definition; there can be only one auto column and it must be defined as a key

Table structure in phpmyadmin

enter image description here

SHOW CREATE TABLE

enter image description here

1

The problem is that you can not create AUTO_INCREMENT without a key so try something like this:

CREATE TABLE `project_application` (
`id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT,
`user_id` int(11) NOT NULL,
`project_title` varchar(255) NOT NULL,
`project_id` int(11) NOT NULL,
`team_leader` varchar(255) NOT NULL,
`team_member` text,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE     CURRENT_TIMESTAMP,
`createt_et` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00'
) 

Hope this helps

0

If anyone encounters this problem this is what you can do. select the table which id column is repeating "0". Select STRUCTURE at the top menu. Drop the id field and create another id field which has an A_I (auto_increment) enabled.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.