[eluser]dottedquad[/eluser]
Hello all,
I am attempting to pass another argument along with with the form element to the set_rules
set_rules code:
Code:
$this->form_validation->set_rules('alias', 'Alias_Exist', 'callback_alias_exist_check[livestock.alias]', 'trim|xss_clean');
call back function:
Code:
function alias_exist_check($str, $val)
{
//echo 'value ' . $str;
list($table, $column) = explode('.', $val, 2);
$query = $this->db->query("SELECT COUNT(*) AS count FROM $table WHERE $column = $str'");
$row = $query->row();
return ($row->count > 0) ? FALSE : TRUE;
}
error:
A PHP Error was encountered
Severity: Notice
Message: Undefined offset: 1
Filename: controllers/validate_livestock.php
Line Number: 105
line 105:
Code:
list($table, $column) = explode('.', $val, 2);
I slapped that code together after searching google for examples. I am new to the explode code, but do understand the purpose which is, split livestock.alias to variables. However, I am receiving the error explained above. I do not understand what the error means or how to fix this. Any help is greatly appreciated.
-Thank You,
Rich