Hi everyone,
I have a problem with validation script here:
*******The first script I used*********
function beforeValidate() {
if (!$this->id) {
if ($this->findCount(array('User.username'
=> $this->data['User']['username'])) > 0) {
$this->invalidate('username_unique');
return false;
}
}
return true;
}
*******The second script I used*********
function beforeValidate() {
if (!$this->id) {
if ($this->find('count',array('conditions' =>array('User.username' =>
$this->data))) > 0) {
$this->invalidate('username_unique');
return false;
}
}
return true;
}
***
Error I get:
Warning (512): SQL Error: 1062: Duplicate entry 'James5' for key
'username' [CORE\cake\libs\model\datasources\dbo_source.php, line 684]
***
It was supposed to display the error msg stating the username already
taken. I don't know where went wrong... Anyone can shed some light
here ?
Check out the new CakePHP Questions site http://cakeqs.org and help others with
their CakePHP related questions.
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