codeigniter form validation callback function with multiple arguments issue: Undefined offset: 1-Collection of common programming errors

I am receiving multiple errors which are listed below my code. There was also a mysql error, but I understood that error due to the parts array null values. I have no idea why I am receiving those errors. Can someone explain with a fix also.

line 106: $this->db->where($parts[1], $value);

code:

$this->form_validation->set_rules('alias','alias_exist','trim|xss_clean|callback_alias_exist_check[livestock.alias]');  

    function alias_exist_check($value, $str)
    {

        $parts = explode('.', $str);    
        $this->db->from($parts[0]);
        $this->db->where($parts[1], $value);
        $result = $this->db->get();

        echo $this->db->last_query();
        //return ($row->count > 0) ? FALSE : TRUE;
        //echo $table . ' ' . $column;
    }

error:

A PHP Error was encountered

Severity: Notice

Message: Undefined offset: 1

Filename: controllers/validate_livestock.php

Line Number: 106

A PHP Error was encountered

Severity: Warning

Message: Cannot modify header information – headers already sent by (output started at /home/dickschi/public_html/lsms/system/libraries/Exceptions.php:166)

Filename: codeigniter/Common.php

Line Number: 356

Thank You,
Rich