Hi,

Thanks, that worked, didn't know about that function.

Do you know if there is an equivalent function to force an UPDATE.

Cheers

Mike

On Apr 25, 6:34 pm, rtconner <[EMAIL PROTECTED]> wrote:
> You should make a a practice to call $this->Model->create() before
> every insert.
>
> So in this example..
>
> $this->ContentBlock->create();
> $this->ContentBlock->save( $quote );
> ...
>
> $this->ContentBlock->create();
> $this->ContentBlock->save( $header );
>
> On Apr 25, 10:11 am, Mike Digital Egg <[EMAIL PROTECTED]>
> wrote:
>
> > Hi,
>
> > I am having a problem trying to save 2 different values to a single
> > table, below is the code:
>
> > if ( $_POST["data"]["Block"][1] ) {
> >         $quote = array(
> >                 'content_id' => $id,
> >                 'block_id' => $_POST["data"]["Block"][1]["id"]
> >         );
> >         $this->ContentBlock->save( $quote );}
>
> > if ( $_POST["data"]["Block"][2] ) {
> >         $header = array(
> >                 'content_id' => $id,
> >                 'block_id' => $_POST["data"]["Block"][2]["id"]
> >         );
> >         $this->ContentBlock->save( $header );
>
> > }
>
> > INSERT INTO `content_blocks` (`content_id`,`block_id`) VALUES
> > ('22','1')
> > SELECT COUNT(*) AS count FROM `content_blocks` WHERE (`id` = '59')
> > UPDATE `content_blocks` SET `content_id` = '22',`block_id` = '8' WHERE
> > `id` = '59'
>
> > It is inserting the first request but then overwriting it with the
> > second, rather than adding a new entry.
>
> > Is there a better way of doing this.
>
> > Thanks
>
> > Mike


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to