This should be done before save() call. First you determine if record
exists. If yes, call update, if no - save.

On Apr 3, 1:38 am, aman batra <[email protected]> wrote:
> I want to save data to my database and the structure is such that if
> the rest record is same i just want to increase the no of visits but
> if the whole info is new then create a new data. I am handling much of
> the code in my beforeSave. How to make an Update and set query work
> from beforeSave as i can not call UpdateAll in this case into my
> beforeSave??
>
> so basically there are two things :-
> 1. if record is old one i just need to update and increae no of views
> by 1
> 2. if new then i would like to create a fresh record.
>
> and to handle this thing in BeforeSave.
>
> thanx.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to