[eluser]John_Betong_002[/eluser]
Try this:
Code:
$this->load->library('table');
$sql = 'SELECT id, title FROM your_table_name LIMIT 0,3';
$query = $this->db->query($sql);
$data = array();
$data[] = array('id', 'title');
foreach($query->result_array() as $row):
$data[] = $row;
endforeach;
$tmpl = array
(
'table_open' => '<table style="border:double 4px #333;width:20em;text-align:center">',
'heading_row_start' => '<tr style="width:10em;color: red">',
'heading_row_end' => '</tr>',
'heading_cell_start' => '<th style="width:10em;color: cyan">',
'heading_cell_end' => '</th>',
'row_start' => '<tr style="width:10em;color:yellow">',
'row_end' => '</tr>',
'cell_start' => '<td style="width:10em;color:green">',
'cell_end' => '</td>',
'row_alt_start' => '<tr style="width:10em;color:blue">',
'row_alt_end' => '</tr>',
'cell_alt_start' => '<td style="width:10em;color:orange">',
'cell_alt_end' => '</td>',
'table_close' => '</table>'
);
$this->table->set_template($tmpl);
echo $this->table->generate($data);
die(QW);
I forgot to mention - Welcome to the forum...
...and to prevent some posters getting upset
1. please post in the correct forum
2. please learn how to enclose your code inside the code tags