So what I'm trying to do:
Pull User data from database, including email address, username etc.
Edit it
- Save it
But I want to keep username and email unique. And for this I'm setting validation rules like this:
$this->form_validation->set_rules('firstname', 'First Name', 'required|min_length[2]|max_length[15]');
$this->form_validation->set_rules('lastname', 'Last Name', 'required|min_length[2]|max_length[15]');
$this->form_validation->set_rules('email', 'Email', 'required|valid_email|is_unique[users.email]');
$this->form_validation->set_rules('username', 'Username', 'required|min_length[4]|max_length[12]|is_unique[users.username]');
$this->form_validation->set_rules('password1', 'Password', 'required|matches[password2]');
$this->form_validation->set_rules('password2', 'Password Confirmation', 'required');
$this->form_validation->set_rules('group', 'User Group', 'required');
And as you can see I have is_unique[users.username]
and is_unique[users.email]
rules. But it doesn't let me update my entry using this rules.
So the question is, how can I update database entry, and keep those 2 fields unique(username and email)?