CodeIgniter Forums
Display Query Results in a Table - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: Display Query Results in a Table (/thread-18453.html)



Display Query Results in a Table - El Forum - 05-06-2009

[eluser]seanloving[/eluser]
I can display my query results in a table when I do this:

Code:
foreach ($content as $key=>$row)
{
     $this->table->add_row($content[$key]);
}

But what if I only want to display some of the columns instead of all the columns? What is wrong with my code?

Code:
foreach ($content as $key=>$row)
{
     $aray[$key] = (     $content[$key]['item_type'],
                         $content[$key]['item_desc'],
                         $content[$key]['mfr_id'],
                         $content[$key]['mfr_pn'],
                         $content[$key]['mfr_sn'],
                         $content[$key]['tag_id'] );

     $this->table->add_row($aray[$key]);
}

Probably something simple. Thanks.

--Sean Loving


Display Query Results in a Table - El Forum - 05-06-2009

[eluser]seanloving[/eluser]
try this

Code:
$aray[$key] = array(...



Display Query Results in a Table - El Forum - 05-07-2009

[eluser]TheFuzzy0ne[/eluser]
Array is two Rs by the way. Smile