How to get table structure in CodeIgniter
Try:
$fields = $this->db->list_fields('table_name');
foreach ($fields as $field)
{
echo $field;
}
From manual
For more descriptive information, you should use
$fields = $this->db->field_data('table_name');
You're going to get something like this foreach field in fields as stdClass
name = "id"
type = "int"
max_length = 11
default = null
primary_key = 1