display data in colums - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: display data in colums (/showthread.php?tid=44162) |
display data in colums - El Forum - 08-05-2011 [eluser]Unknown[/eluser] In html I found out how to display my database in 4 columns using a while loop : id[1] id[2] id[3] id[4] name[1] name[2] name[3] name[4] id[5] ............ name[5]........... In codeigniter I know how to use foreach($query->result() as $row) but I haven't been able to display in columns. I have tried many methods but none of them work. I've tried with <div> and tables. thank you. display data in colums - El Forum - 08-05-2011 [eluser]John_Betong_002[/eluser] Here is one of many methods for you to try: http://ellislab.com/codeigniter/user-guide/libraries/table.html Before I forget, please learn how to use code tags when posting. It really helps others to understand the script and prevents some posters from getting annoyed. Oh and welcome to CI display data in colums - El Forum - 08-07-2011 [eluser]Unknown[/eluser] Thank you John_Betong_002. But how can I turn "$data['query']=$this->db->get('mytable');" into a one-dimensional array so I can apply $this->table->make_columns(). display data in colums - El Forum - 08-07-2011 [eluser]John_Betong_002[/eluser] Try this: Code: $this->load->library('table'); I forgot to mention - Welcome to the forum... ...and to prevent some posters getting upset 1. please post in the correct forum 2. please learn how to enclose your code inside the code tags display data in colums - El Forum - 08-08-2011 [eluser]John_Betong_002[/eluser] Hi dvinatea, Thanks for the jpg showing what you require. I had some time on my hands so created the following demo source |