Welcome Guest, Not a member yet? Register   Sign In
How to output database to table formated into rows and columns
#3

[eluser]huzzel[/eluser]
Hi,

i prefer this :-)
Code:
// generate table data
        $this->load->library('table');
        $this->table->set_empty(" ");
        $this->table->set_heading('No', 'Name', 'Gender', 'Date of Birth (dd-mm-yyyy)', 'Actions');
        $i = 0 + $offset;
        foreach ($persons as $person){
            $this->table->add_row(++$i, $person->name, strtoupper($person->gender)=='M'? 'Male':'Female', date('d-m-Y',strtotime($person->dob)),
                anchor('person/view/'.$person->id,'view',array('class'=>'view')).' '.
                anchor('person/update/'.$person->id,'update',array('class'=>'update')).' '.
                anchor('person/delete/'.$person->id,'delete',array('class'=>'delete','onclick'=>"return confirm('Are you sure want to delete this person?')"))
            );
        }
        $data['table'] = $this->table->generate();


Messages In This Thread
How to output database to table formated into rows and columns - by El Forum - 08-29-2009, 04:27 AM



Theme © iAndrew 2016 - Forum software by © MyBB