![]() |
Creating an HTML table using database results - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22) +--- Thread: Creating an HTML table using database results (/showthread.php?tid=44382) |
Creating an HTML table using database results - El Forum - 08-12-2011 [eluser]carlhussey[/eluser] Hey Guys, I'm having a little trouble with this mostly because I'm still learning. Anyway, Im trying to create a table and then have it add a new row to the table for each result. Here is my code.. Code: $this->load->library('table'); Basicly, where im stuck is.. $this->table->add_row('1', '', '', '', '', ''); I'm not sure if thats how you would add a new row to the table? I figured it would need to be in a loop and every time it gets a result it runs the add row. Am I even close? Creating an HTML table using database results - El Forum - 08-12-2011 [eluser]Aken[/eluser] You can load data into the table straight from the DB query object. Code: $this->load->library('table'); And in the future, please use the Reactor forum to discuss your application's code. This section is meant for sharing completed and working code with others. Creating an HTML table using database results - El Forum - 08-12-2011 [eluser]carlhussey[/eluser] I get that and I had it like that before and it worked fine. I just couldnt figure out how to customize it with my own stuff if i didnt want a database result there. For example if i wanted an incrementing number in the first column or links in the last one? Rather than only show content just stored in the field, id like to be able to tweak certain data in certain columns. Sorry about the wrong forum, didnt see the other one. Creating an HTML table using database results - El Forum - 08-12-2011 [eluser]Aken[/eluser] Then use add_row() like you were trying (though not going through results properly): Code: $this->load->library('table'); Creating an HTML table using database results - El Forum - 08-12-2011 [eluser]carlhussey[/eluser] Awesome, thanks so much for the help! Just what I needed ![]() |