Welcome Guest, Not a member yet? Register   Sign In
Crazy with callbacks
#6

(This post was last modified: 06-10-2015, 06:47 AM by StratoKyke.)

I show you the code of the other case. I seeing that this solved is_unique.

Model:
PHP Code:
public function username_check($username) {
            
$account $this->load->database('account'TRUE);
            
$account->where('login',$username);
            
$query $account->get('account');
            if (
$query->num_rows() > 0){
                echo 
$query->num_rows();
                
$this->form_validation->set_message('username_check_exist''L´username è già utilizzato.');
                return 
FALSE;
            }else{
                return 
TRUE;
            }
        } 

Controller:
PHP Code:
public function username_check_exist($username) {
        
$this->auth->username_check($username);
    }
public function 
register() {
        
$rules = array(
                array(
                    
'field'=>'username',
                    
'label'=>'Account ID',
                    
'rules'=>'trim|required|min_length[6]|max_length[16]|callback_username_check_exist'
                
),
ecc.... 

In this case I can try to stamp the $query->num_rows() and the result is 1 in the page... but It does not show the error code.

And if I fill out all the fields also launches the query.
Reply


Messages In This Thread
Crazy with callbacks - by StratoKyke - 06-10-2015, 05:37 AM
RE: Crazy with callbacks - by StratoKyke - 06-10-2015, 05:59 AM
RE: Crazy with callbacks - by CroNiX - 06-10-2015, 06:34 AM
RE: Crazy with callbacks - by StratoKyke - 06-10-2015, 06:37 AM
RE: Crazy with callbacks - by CroNiX - 06-10-2015, 06:41 AM
RE: Crazy with callbacks - by StratoKyke - 06-10-2015, 06:45 AM
RE: Crazy with callbacks - by CroNiX - 06-10-2015, 06:49 AM
RE: Crazy with callbacks - by StratoKyke - 06-10-2015, 06:52 AM
RE: Crazy with callbacks - by CroNiX - 06-10-2015, 07:01 AM
RE: Crazy with callbacks - by StratoKyke - 06-10-2015, 07:07 AM
RE: Crazy with callbacks - by CroNiX - 06-10-2015, 07:12 AM
RE: Crazy with callbacks - by StratoKyke - 06-10-2015, 07:23 AM
RE: Crazy with callbacks - by CroNiX - 06-10-2015, 07:38 AM
RE: Crazy with callbacks - by StratoKyke - 06-10-2015, 08:38 AM
RE: Crazy with callbacks - by Blair2004 - 06-10-2015, 11:38 AM



Theme © iAndrew 2016 - Forum software by © MyBB