On 8 Feb., 17:41, Alfredo Quiroga-Villamil <laww...@gmail.com> wrote:
> Marcus:
>
> If I understood the question correctly what you are looking for is the
> following:
>
> If a user goes to make an entry into the table you've created, and the
> column1-column2 combination already exists for that particular user
> then you want to stop them from being able to re-enter it.
>
> If that is the case, one possible solution would be to simply check
> and see if column1 and 2 exist for that particular user id, if it
> does, then let them know they already have such combination.
>
> $iTotal = $this->Model->find('count',
>    array(
>       'conditions' => array(
>          'user_id' => $iUserId
>          ,'col1'    => $sCol1
>          ,'col2'    => $sCol2
>       )
>    )
> );
>
> if ( $iTotal > 0 ) {
>    // User has that combination} else {
>
>    // Enter the combination into the Table, new entry.
>
> }
>
> I wrote this very quickly and off the top of my head; I am pretty new
> to cakephp so the syntax might not be right; but I think that's the
> overall idea assuming I correctly understood your requirement.
>
> Regards,
>
> Alfredo
>
Great Alfredo,

That way is easy but and very good. Great Thank you!!

many greetings

Marcus Radisch
--~--~---------~--~----~------------~-------~--~----~
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