Because Sir, Primary key follows a rule is that it will not allowed to add primary key to multiple table, that's why its showing error of duplicate primary key on date column and for previous problem i checked your code then i found that there was problem with your database connection otherwise there was no problem i had created after accurate db connection code