Welcome Guest, Not a member yet? Register   Sign In
Is_Unique validation with custom db table
#6

[eluser]xjermx[/eluser]
I am also trying to get unique validation to work.

I am working with CodeIgniter/Doctrine.

In my case, I have a registration form, and I want to check to be sure that any email address entered is unique.

I have tried this:
Code:
$this->form_validation->set_rules('email', 'E-mail',
                 'required|valid_email|is_unique[users.email]');

Which returns:
Quote:A PHP Error was encountered

Severity: Notice

Message: Undefined property: Signup_form::$db

Filename: libraries/Form_validation.php

Line Number: 954


Fatal error: Call to a member function limit() on a non-object in /../systemFolder/libraries/Form_validation.php on line 954

I have also tried following the example on the form_validation page in the user guide for CI:

Code:
$this->form_validation->set_rules('email', 'E-mail', 'callback_email_check');
(along with an email_check function, basically copy/pasted from the example in the user guide)

This gives me:

Quote:Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '[email protected]' for key 'email_index'' in /../applicationFolder/libraries/Doctrine/DBAL/Statement.php:131 Stack trace: #0 /../applicationFolder/libraries/Doctrine/DBAL/Statement.php(131): PDOStatement->execute(NULL) #1 /../applicationFolder/libraries/Doctrine/ORM/Persisters/BasicEntityPersister.php(239): Doctrine\DBAL\Statement->execute() #2 /../applicationFolder/libraries/Doctrine/ORM/UnitOfWork.php(896): Doctrine\ORM\Persisters\BasicEntityPersister->executeInserts() #3 /../applicationFolder/libraries/Doctrine/ORM/UnitOfWork.php(304): Doctrine\ORM\UnitOfWork->executeInserts(Object(Doctrine\ORM\Mapping\ClassMetadata in /../applicationFolder/libraries/Doctrine/DBAL/Statement.php on line 131

What am I doing wrong?


Messages In This Thread
Is_Unique validation with custom db table - by El Forum - 04-04-2012, 07:03 AM
Is_Unique validation with custom db table - by El Forum - 04-04-2012, 11:51 AM
Is_Unique validation with custom db table - by El Forum - 04-04-2012, 01:06 PM
Is_Unique validation with custom db table - by El Forum - 04-04-2012, 01:38 PM
Is_Unique validation with custom db table - by El Forum - 04-06-2012, 06:07 AM
Is_Unique validation with custom db table - by El Forum - 04-06-2012, 07:30 AM
Is_Unique validation with custom db table - by El Forum - 04-06-2012, 09:19 AM
Is_Unique validation with custom db table - by El Forum - 04-06-2012, 09:23 AM
Is_Unique validation with custom db table - by El Forum - 04-07-2012, 05:37 AM



Theme © iAndrew 2016 - Forum software by © MyBB