[eluser]xwero[/eluser]
You are making it to complex i think
Code:
$lancode=$this->lans->returnonlycode($lancode);
The $lancode as parameter doesn't exist so it has no value and your returnonlycode code has no parameters so there is no need to add it.
Code:
function returnonlycode()
{
$data = array();
$this->db->select('lan_code');
$query= $this->db->get('lan');
if ( $query-> num_rows() > 0){
foreach ( $query-> result_array() as $row){
$data[] = $row;
}
}
$query-> free_result();
return $data;
}
The result_array method returns an empty array if nothing is found so
Code:
function returnonlycode()
{
$this->db->select('lan_code');
$query= $this->db->get('lan');
return $query->result_array();
}
will do.
Why are you putting the rules in another function?
For the rules not being added you could check if with print_r($rules) to check if the rules are added. If you keep the function you can check with print_r($this->validation->_rules) if the rules in your function are attached to the validation class and are the ones that are going to be checked.