Re: saveField generating extra record even after id is set

2008-01-05 Thread hmpierson

Just out of curiosity...have you tried running that same SQL query for
the same ID outside of Cake?

Perhaps it's returning more than one record. if so, you might try
adding a limit condition of "1" to your find statement.

On Jan 4, 7:49 pm, skoggins <[EMAIL PROTECTED]> wrote:
> Yeah sorry, typo.  I fixed that and now am back to the original
> problem.  It updates the record but also saves 3 blank records.  Could
> this be because there are frames on the page?
>
> $this->Account->Note->Sentmessage->AllowedView->recursive = -1;
> $conditions = "AllowedView.note_id = '$id' AND AllowedView.user_id =
> '$user_id'";
> $myallowedview = $this->Account->Note->AllowedView->find($conditions);
> $date = date("Y-m-d H:i:s", time()); //need to find current date
> $this->Account->Note->AllowedView->id = $myallowedview['AllowedView']
> ['id'];
> $this->Account->Note->AllowedView->saveField("date_viewed", $date);

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: saveField generating extra record even after id is set

2008-01-04 Thread skoggins

Yeah sorry, typo.  I fixed that and now am back to the original
problem.  It updates the record but also saves 3 blank records.  Could
this be because there are frames on the page?

$this->Account->Note->Sentmessage->AllowedView->recursive = -1;
$conditions = "AllowedView.note_id = '$id' AND AllowedView.user_id =
'$user_id'";
$myallowedview = $this->Account->Note->AllowedView->find($conditions);
$date = date("Y-m-d H:i:s", time()); //need to find current date
$this->Account->Note->AllowedView->id = $myallowedview['AllowedView']
['id'];
$this->Account->Note->AllowedView->saveField("date_viewed", $date);
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---



Re: saveField generating extra record even after id is set

2008-01-04 Thread skoggins

Actually, it looks like it is just generating a new record and is not
updating the existing one.  So this must be an issue with setting the
id, right?  What am I doing wrong?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---



RE: saveField generating extra record even after id is set

2008-01-04 Thread Christian Winther

$this->Account->Conectnote->AllowedView->save("date_viewed", $date);
Should be
$this->Account->Conectnote->AllowedView->saveField("date_viewed", $date);

?

-Original Message-
From: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of skoggins
Sent: 5. januar 2008 01:24
To: Cake PHP
Subject: saveField generating extra record even after id is set


Hi all,

In my controller I am trying to update a single field in my
allowedviews table.  Not only is the record updating but a new record
is generated which is empty except for 'date_viewed'.  Could someone
check the below code and let me know if they see something wrong?

Thanks!

Accounts Controller:

$this->Account->Note->Sentmessage->AllowedView->recursive = -1;
$conditions = "AllowedView.note_id = '$id' AND AllowedView.user_id =
'$user_id'";
$myallowedview = $this->Account->Note->AllowedView->find($conditions);
$this->Account->Note->AllowedView->id = $myallowedview['AllowedView']
['id'];
$date = date("Y-m-d H:i:s", time()); //need to find current date
$this->Account->Conectnote->AllowedView->save("date_viewed", $date);


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---