You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
World Wide Web Server edited this page Jul 4, 2012
·
14 revisions
Category:Help::TipsAndTricksCategory:Table
I feel we don't have enough sample code so here is one from me on how to get stuff from the database and feed it in to a table:
[code]
function index()
{
$query = $this->db->getwhere('Ticket', array('uid' => $this->uid));
if ($query->num_rows() > 0)
{
foreach($query->result_array() as $k => $s):
$tbresult[$k] = $s;
endforeach;
// Remove id fields
$tbresult = $this->fun->unsetids($tbresult);
$this->load->library('table');
foreach($tbresult as $row):
$v = $row['Ticket No'];
$row['Ticket No'] = anchor('ticket/view/'.$v,$v);
$this->table->add_row($row);
endforeach;
$this->table->set_heading(array_keys($row));
$this->tpl['body'] = $this->table->generate();
$this->table->clear();