Alternatively if you have a different primary key for your table you
can use

 var $primaryKey = 'my_primary_key';

in your model to use something other than 'id'.

Hope that helps.

On Jan 9, 10:22 am, nurvzy <nur...@gmail.com> wrote:
> You're setting which friends row to update in the table by the id:
>
>  $this->id = $id;
>
> So its going to use that id as the where clause.  The SQL you're
> getting seems like desired behavior, maybe you don't have an id column
> in you friends table?
>
> Your table structure should always include an 'id' field set to integer
> (11), primary, unsigned and auto-increment.
>
> On Jan 8, 4:16 pm, Miles J <mileswjohn...@gmail.com> wrote:
>
> > Hmmm, this finally runs an update:
>
> >         function block($id) {
> >                 $this->id = $id;
>
> >                 $data = array();
> >                 $data['Friend']['status'] = 'blocked';
> >                 $data['Friend']['blockedTime'] = time();
>
> >                 return $this->save($data, false);
> >         }
>
> > But no rows are affected by it, because its calling friends.id, ideas?
>
> > UPDATE `friends` SET `status` = 'blocked', `blockedTime` = 1231456514
> > WHERE `friends`.`id` = 23
--~--~---------~--~----~------------~-------~--~----~
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