04-10-2008, 09:01 PM
Bon, j'aurais dû le faire dès le début finalement, ça réduit plutôt significativement le code :
Code PHP :
<?php
$selectQuery = "SELECT login, email, firsname, lastname FROM users" .
"WHERE login = %s OR email = %s OR (firstname = %s AND lastname = %s);";
$selectQuery = sprintf(
$selectQuery,
$this->input->post('login'),
$this->input->post('email'),
$this->input->post('firstname'),
$this->input->post('lastname')
);
$selectResult = $this->db->query($selectQuery);
$selectArray = $selectResult->result_array();
if($selectArray['login'] == $this->input->post('login')){
$this->validation->login_error = $this->lang->line('This login is already used.');
$this->layout->view('profile/inscriptionForm');
return FALSE;
}elseif($selectArray['email'] == $this->input->post('email')){
$this->validation->email_error = $this->lang->line('This email is already used.');
$this->layout->view('profile/inscriptionForm');
return FALSE;
}elseif($selectArray['firstname'] == $this->input->post('firstname')
AND $selectArray['lastname'] == $this->input->post('lastname')){
$this->validation->firstname_error = $this->lang->line('These firstname and lastname are already used.');
$this->layout->view('profile/inscriptionForm');
return FALSE;
}
@tchaOo°