Thanks for your response, I have already deleted the user table once.. The code is mostly used from the bake tool.
Here is the snapshot of my UsersController. https://github.com/mohitkr05/Competence/blob/master/Controller/UsersController.php There are no entry for id=0; mysql> SELECT id,username FROM users WHERE id=0; Empty set (0.16 sec) My snapshot of user table +----+-----------+ | id | username | +----+-----------+ | 1 | vaibhav | | 2 | vaibhav | | 3 | mohitkr05 | | 4 | vishal | +----+-----------+ 4 rows in set (0.03 sec) and its sql is CREATE TABLE IF NOT EXISTS `users` ( `id` int(11) NOT NULL AUTO_INCREMENT, `username` varchar(50) DEFAULT NULL, `password` varchar(50) DEFAULT NULL, `role` varchar(20) DEFAULT NULL, `experience` int(11) NOT NULL, `created` datetime DEFAULT NULL, `modified` datetime DEFAULT NULL, PRIMARY KEY (`id`) ) Thanks for your help. On Fri, Jul 13, 2012 at 1:58 PM, Mike Griffin <[email protected]> wrote: > On Wed, Jul 11, 2012 at 2:39 PM, mohit kumar <[email protected]> wrote: > > Hi Folks, > > > > I created an add action for users, > > I am trying to register them using this action. Everything is going fine, > > the data is being submitted, the passwords are being hash and if I check > the > > registration is happening. But I am getting the following error. > > > >> Integrity constraint violation: 1062 Duplicate entry '0' for key > 'PRIMARY' > > There shouldn't be an id of 0 if its auto incrementing. Did you set an > auto_increment_offset anywhere? > What is your add action? Post the code here so we can see if the id is > being set anywhere. > > What happens if you run: > SELECT id,username FROM users WHERE id=0; > > Mike. > > -- > Our newest site for the community: CakePHP Video Tutorials > http://tv.cakephp.org > Check out the new CakePHP Questions site http://ask.cakephp.org and help > others with their CakePHP related questions. > > > To unsubscribe from this group, send email to > [email protected] For more options, visit this group > at http://groups.google.com/group/cake-php > -- Best Regards, Mohit Kumar -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/cake-php
