I believe that you are missing: $this->Category->create();
$this->Category->create();
$data['Category']['parent_id'] = 3;
$data['Category']['name'] = $fieldName ;
if($this->Category->save($data)){
exit;
}
I don't believe this is deprecated or is it?
On Aug 23, 12:56 pm, Abrar <[EMAIL PROTECTED]> wrote:
> hi , here im trying to use generatetreelist() first time, so whats
> problem im facing is that it saves the data two times with once
> execution of code.
>
> here is my code that im using
>
> function addData($fieldName = null, $pa_id = null){
>
> $existance = $this->Category->findByName($fieldName);
> if($existance){
> $this->set('error','This name already exists.');
> }else{
> $data['Category']['parent_id'] = 3;
> $data['Category']['name'] = $fieldName ;
> if($this->Category->save($data)){
> exit;
> }
> }
> }//addData
>
> result in the database
>
> id parent_id lft rght name
> ------------------------------------------------------------
> 48 3 34 35 bari ----------->
> only this result should be saved here
>
> 47 3 NULL NULL bari ---------------> this
> is unexpected ( problem )
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---