CodeIgniter Forums
Generate Table From Query ( Where? ) - 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: Generate Table From Query ( Where? ) (/showthread.php?tid=56510)



Generate Table From Query ( Where? ) - El Forum - 12-26-2012

[eluser]Unknown[/eluser]
This code to generate a table from a query. where do i put it in the MVC ?

Code:
echo $this->table->generate($query);

in the model i got this right now

Code:
$this->db->select('*')->from('posts');
$query = $this->db->get();
return $query->result();

Thanks! Notflip -novice


Generate Table From Query ( Where? ) - El Forum - 12-27-2012

[eluser]Future Webs[/eluser]
you do the database work in the model
assign the query in the controller and pass to the view
display the table using the echo statement in your view