If you know which field you need to update perhaps you could try
using :

   saveField(string $fieldName, string $fieldValue, $validate = false)

From
 : http://book.cakephp.org/view/75/Saving-Your-Data


GL - Phil


On Aug 11, 8:03 pm, tron <tken...@gmail.com> wrote:
> I have a problem with one specific controller trying to INSERT instead
> of UPDATE and I am getting duplicate entry errors. the "$this->data"
> variable contains the correct primary key of table I'm trying to
> update, but still tries to INSERT instead. Most notable text message
> is this in the debug dump: SELECT COUNT(*) AS `count` FROM `employees`
> AS `Employee` WHERE `Employee`.`id` IS NULL. Apparently its not
> getting the id at all?
>
> Code:
>
>         function        edit( $id = null )
>         {
>         pr( $id );
>         pr( $this->data );
>         $this->Employee->id = $id;
>
>         if( !empty( $this->data ) )
>         {
>             if( $this->Employee->save( $this->data ) )
>             {
>             }
>
>         } else {
>             $this->data = $this->Employee->read( null, $id );
>         }
>         }
>
> Both the pr functions display the correct data that suggests it should
> be doing an UPDATE instead of INSERT.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to