db to table

Derek Jones edited this page Jul 5, 2012 · 14 revisions
Clone this wiki locally

Category:Help::TipsAndTricks Category:Table

Updating my contributions on the wiki has become a nightmare. Please check my svn at google for the latest revisions: http://code.google.com/p/tamer/ CI_TaMeR SVN

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:

    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;
            // Remove id fields
            $tbresult = $this->fun->unsetids($tbresult);
            foreach($tbresult as $row):
            $v = $row['Ticket No'];
            $row['Ticket No'] = anchor('ticket/view/'.$v,$v);
            $this->tpl['body'] = $this->table->generate();


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

And this is what it looks like unformatted. You can use css to change the look Image:Screenshot.gif