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

On Sun, Feb 8, 2009 at 9:41 AM, amarradi <radis...@googlemail.com> wrote:
>
> Hello together,
>
> i've an DB - Table with two interessting columns. So now i want check
> if somebody enter the same Words. Let me explain a little bit more
>
> column 1 | column 2
> Table | Chair
>
> So if somebody enter the same combination in the Textfield the line
> souldn't add to Table
>
> My prefered Test-construct is
> $results = $this->MyModel->find(
> 'AND' => array
> (array(
> 'column1'=> $this->data['MyModel']['column1']),
> 'column2'=> $this->data['MyModel']['column2'])
> );
> But if somebody Type Table | Wall e.q. That is correct. Only the same
> String-combination
>
> In http://book.cakephp.org/view/73/Retrieving-Your-Data i found not
> really help. Can everyone help me
> How does it run correctly?
>
> 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