{"id":6042,"date":"2014-04-12T02:53:46","date_gmt":"2014-04-12T02:53:46","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/04\/12\/codeigniter-form-validation-callback-function-with-multiple-arguments-issue-undefined-offset-1-collection-of-common-programming-errors-2\/"},"modified":"2014-04-12T02:53:46","modified_gmt":"2014-04-12T02:53:46","slug":"codeigniter-form-validation-callback-function-with-multiple-arguments-issue-undefined-offset-1-collection-of-common-programming-errors-2","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/04\/12\/codeigniter-form-validation-callback-function-with-multiple-arguments-issue-undefined-offset-1-collection-of-common-programming-errors-2\/","title":{"rendered":"codeigniter form validation callback function with multiple arguments issue: Undefined offset: 1-Collection of common programming errors"},"content":{"rendered":"<p>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.<\/p>\n<p>line 106: <code>$this-&gt;db-&gt;where($parts[1], $value);<\/code><\/p>\n<p>code:<\/p>\n<pre><code>$this-&gt;form_validation-&gt;set_rules('alias','alias_exist','trim|xss_clean|callback_alias_exist_check[livestock.alias]');  \n\n    function alias_exist_check($value, $str)\n    {\n\n        $parts = explode('.', $str);    \n        $this-&gt;db-&gt;from($parts[0]);\n        $this-&gt;db-&gt;where($parts[1], $value);\n        $result = $this-&gt;db-&gt;get();\n\n        echo $this-&gt;db-&gt;last_query();\n        \/\/return ($row-&gt;count &gt; 0) ? FALSE : TRUE;\n        \/\/echo $table . ' ' . $column;\n    }\n<\/code><\/pre>\n<p>error:<\/p>\n<p>A PHP Error was encountered<\/p>\n<p>Severity: Notice<\/p>\n<p>Message: Undefined offset: 1<\/p>\n<p>Filename: controllers\/validate_livestock.php<\/p>\n<p>Line Number: 106<\/p>\n<p>A PHP Error was encountered<\/p>\n<p>Severity: Warning<\/p>\n<p>Message: Cannot modify header information &#8211; headers already sent by (output started at \/home\/dickschi\/public_html\/lsms\/system\/libraries\/Exceptions.php:166)<\/p>\n<p>Filename: codeigniter\/Common.php<\/p>\n<p>Line Number: 356<\/p>\n<p>Thank You,<br \/>\nRich<\/p>\n","protected":false},"excerpt":{"rendered":"<p>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-&gt;db-&gt;where($parts[1], $value); code: $this-&gt;form_validation-&gt;set_rules(&#8216;alias&#8217;,&#8217;alias_exist&#8217;,&#8217;trim|xss_clean|callback_alias_exist_check[livestock.alias]&#8217;); function alias_exist_check($value, $str) [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-6042","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/6042","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=6042"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/6042\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=6042"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=6042"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=6042"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}