Skip to content
World Wide Web Server edited this page Jul 4, 2012 · 14 revisions

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'); $this->table->set_heading(array_keys($tbresult[0])); foreach($tbresult as $row): $v = $row['Ticket No']; $row['Ticket No'] = anchor('ticket/view/'.$v,$v); $this->table->add_row($row); endforeach;
$this->tpl['body'] = $this->table->generate(); $this->table->clear();

    }

    $this->load->view('layout/blank', $this->tpl);
}

[/code] And this is what it looks like unformatted. You can use css to change the look Image:Screenshot.gif Category:Help::TipsAndTricks

Clone this wiki locally