{"id":826,"date":"2022-08-30T15:07:49","date_gmt":"2022-08-30T15:07:49","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2013\/11\/09\/codeigniter-passing-array-from-controller-to-view-undefined-index-error-collection-of-common-programming-errors\/"},"modified":"2022-08-30T15:07:49","modified_gmt":"2022-08-30T15:07:49","slug":"codeigniter-passing-array-from-controller-to-view-undefined-index-error-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2022\/08\/30\/codeigniter-passing-array-from-controller-to-view-undefined-index-error-collection-of-common-programming-errors\/","title":{"rendered":"codeigniter passing array from controller to view undefined index error-Collection of common programming errors"},"content":{"rendered":"<p>your <code>$this-&gt;rootbeer_model-&gt;community_single($rb);<\/code> will return an array like this ie, <code>rb_data=[[id=&gt;1,value=&gt;'a'],[id=&gt;2,value=&gt;'b'],[id=&gt;3,value=&gt;'c']]<\/code><\/p>\n<p>so first you need to fetch the row that you wand, using this functions,<\/p>\n<pre><code>1. foreach($rb_data as $row){<\/code><\/pre>\n<p>}?&gt; 2. $row = $rb_data-&gt;first_row() $row = $rb_data-&gt;last_row() $row = $rb_data-&gt;next_row() $row = $rb_data-&gt;previous_row() 3.$row = $rb_data-&gt;row(5);<\/p>\n<p>then you can access `$row[&#8216;band&#8217;]&#8217;<\/p>\n<pre><code>`$rb_data` doesn't contains an index like `band` . `$rb_data` contains only rows\n<\/code><\/pre>\n<p id=\"rop\"><small>Originally posted 2013-11-09 22:47:53. <\/small><\/p>","protected":false},"excerpt":{"rendered":"<p>your $this-&gt;rootbeer_model-&gt;community_single($rb); will return an array like this ie, rb_data=[[id=&gt;1,value=&gt;&#8217;a&#8217;],[id=&gt;2,value=&gt;&#8217;b&#8217;],[id=&gt;3,value=&gt;&#8217;c&#8217;]] so first you need to fetch the row that you wand, using this functions, 1. foreach($rb_data as $row){ }?&gt; 2. $row = $rb_data-&gt;first_row() $row = $rb_data-&gt;last_row() $row = $rb_data-&gt;next_row() $row = $rb_data-&gt;previous_row() 3.$row = $rb_data-&gt;row(5); then you can access `$row[&#8216;band&#8217;]&#8217; `$rb_data` doesn&#8217;t contains an index [&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-826","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/826","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=826"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/826\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=826"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=826"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=826"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}