[eluser]cPage[/eluser]
Put this code in your model...
Code:
function select_fields($string = NULL)
{
if($string !== NULL)
{
$q = $this->db->query('SELECT '.$string.' FROM '.$this->table);
}
else
{
$q = $this->db->query('SELECT * FROM '.$this->table);
}
return $q->list_fields();
}
In your controller...
Code:
$this->data['fields'] = $this->client_model->select_fields('client,email');
In your view...
Code:
<table>
<?php
echo'<tr>';
foreach($fields as $field)
{
echo '<th>'.$field.'</th>';
}
echo'</tr>';
...