Re: Problem with adding records
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
Nr | Query | Error | Affected | Num. rows | Took (ms) |
---|---|---|---|---|---|
1 | INSERT 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') | 1 | 1 | 169 | |
2 | SELECT `UsersCertification`.`certification_id` FROM `competence`.`users_certifications` AS `UsersCertification` WHERE `UsersCertification`.`user_id` = 5 | 0 | 0 | 0 | |
3 | BEGIN |
The debug information on the page is
- CORE\Cake\Model\Model.php line 1884 → DboSource->insertMulti(AppModel, array, array)
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 <griffinm@gmail.com> wrote:
What is in the $this->request->data array?
Mike
On Fri, Jul 13, 2012 at 2:32 PM, mohit kumar <mohitkr05@gmail.com> 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 <griffinm@gmail.com> wrote:
>>
>> On Wed, Jul 11, 2012 at 2:39 PM, mohit kumar <mohitkr05@gmail.com> 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
>> cake-php+unsubscribe@googlegroups.com 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
> cake-php+unsubscribe@googlegroups.com 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
cake-php+unsubscribe@googlegroups.com 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
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home