Difficult to be precise withhout seeing the table structure, but I
would use Cake to validate the fields, i.e. check that the values are
valid, then use PHP/Cake to see if there is already a corresponding
entry. If there is return an error state.
On 2 Jul, 09:49, kaushik <[EMAIL PROTECTED]> wrote:
> I want to give validation to prevent duplicate entry in category
> table.
>
> Now my model is like that:-
>
> class category extends AppModel
> {
> var $name = 'Category';
> var $primaryKey = 'categoryId';
> var $validate = array(
> 'categoryName' => VALID_NOT_EMPTY,
> );
>
> }
>
> the controller for addition function:-
>
> function admin_add()
> {
> if (!empty($this->data['Category']))
> {
> if ($this->Category->save($this->data))
> $this->flash('Your note has been added.','../categories/',5);
> }
>
> }
>
> what i have to do? Please help me.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---