Now the problems are still same, I upgraded to the new version of cake php.
I have deleted and created the database again.
still i am getting same error.

When i try to execute the same query with mysql, it generates no error.

Here is the output of the sql dump from cake php, if executed on mysql , it
generates no error
NrQueryErrorAffectedNum. rowsTook (ms)  1INSERT INTO `competence`.`users`
(`username`, `password`, `role`, `experience`, `modified`, `created`)
VALUES ('mohit', 'mohit', 'Engineer', 1, '2012-07-15 08:48:26', '2012-07-15
08:48:26')
11151 2SELECT `UsersCertification`.`certification_id` FROM
`competence`.`users_certifications` AS `UsersCertification` WHERE
`UsersCertification`.`user_id` = 6
001 3BEGIN
001


*With Best Regards,
Mohit Kumar <http://kumarmohit.com>*
*+91-9582894570*



On Fri, Jul 13, 2012 at 8:17 PM, mohit kumar <[email protected]> wrote:

> Cake PHP 2.2.0
>
> +-----------+
> | version() |
> +-----------+
> | 5.5.16    |
> +-----------+
> 1 row in set (0.12 sec)
>
>
> On Fri, Jul 13, 2012 at 8:09 PM, Mike Griffin <[email protected]> wrote:
>
>> Where is the error message appearing?
>>
>> I've tried creating a database and creating the table and when I run the
>> INSERT query, it works fine. Can you try running that query from the
>> command line and see what happens then?
>>
>> What version of cakePHP and MySQL are you using?
>>
>>
>> On Fri, Jul 13, 2012 at 3:08 PM, mohit kumar <[email protected]> wrote:
>>
>>> That was I guess added by bake tool, i did not code the add function.
>>>
>>> the information that i get when i try to add is as follows
>>>
>>>
>>>
>>> NrQueryErrorAffectedNum. rowsTook (ms)  1INSERT INTO
>>> `competence`.`users` (`username`, `password`, `role`, `experience`,
>>> `modified`, `created`) VALUES ('sid',
>>> '8fee7c4fe462305bdbb0acad830137f0d40af5a2', 'admin', 1, '2012-07-13
>>> 16:01:47', '2012-07-13 16:01:47')
>>> 11169 2SELECT `UsersCertification`.`certification_id` FROM
>>> `competence`.`users_certifications` AS `UsersCertification` WHERE
>>> `UsersCertification`.`user_id` = 5
>>> 000 3BEGIN
>>> The debug information on the page is
>>>
>>>
>>>
>>>
>>>    - CORE\Cake\Model\Model.php line 
>>> 1884<http://localhost/cake/competence/users/add#>→ 
>>> DboSource->insertMulti(AppModel,
>>>    array, array) <http://localhost/cake/competence/users/add#>
>>>
>>>    object(AppModel) {
>>>     useDbConfig => 'default'
>>>     useTable => 'users_certifications'
>>>     id => false
>>>     data => array([maximum depth reached])
>>>     schemaName => 'competence'
>>>     table => 'users_certifications'
>>>     primaryKey => 'id'
>>>     validate => array([maximum depth reached])
>>>     validationErrors => array([maximum depth reached])
>>>     validationDomain => null
>>>     name => 'UsersCertification'
>>>     alias => 'UsersCertification'
>>>     tableToModel => array(
>>>             [maximum depth reached]
>>>     )
>>>     cacheQueries => false
>>>     belongsTo => array([maximum depth reached])
>>>     hasOne => array([maximum depth reached])
>>>     hasMany => array([maximum depth reached])
>>>     hasAndBelongsToMany => array([maximum depth reached])
>>>     actsAs => null
>>>     Behaviors => object(BehaviorCollection) {}
>>>     whitelist => array([maximum depth reached])
>>>     cacheSources => true
>>>     findQueryType => null
>>>     recursive => (int) 1
>>>     order => null
>>>     virtualFields => array([maximum depth reached])
>>>     __backAssociation => array([maximum depth reached])
>>>     __backInnerAssociation => array([maximum depth reached])
>>>     __backOriginalAssociation => array([maximum depth reached])
>>>     __backContainableAssociation => array([maximum depth reached])
>>>     findMethods => array(
>>>             [maximum depth reached]
>>>     )
>>>     tablePrefix => ''
>>>    }
>>>    array(
>>>     (int) 0 => '`user_id`',
>>>     (int) 1 => '`certification_id`'
>>>    )
>>>    array(
>>>     (int) 1 => array(
>>>             (int) 0 => '5',
>>>             (int) 1 => '1'
>>>     )
>>>    )
>>>
>>>
>>>
>>> On Fri, Jul 13, 2012 at 7:12 PM, Mike Griffin <[email protected]>wrote:
>>>
>>>> What is in the $this->request->data array?
>>>>
>>>> Mike
>>>>
>>>> On Fri, Jul 13, 2012 at 2:32 PM, mohit kumar <[email protected]>
>>>> wrote:
>>>> > 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
>>>>
>>>> --
>>>> 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
>>>
>>
>>  --
>> 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

Reply via email to