Say my application has a “Posts” model, and one of the function is add_post(), it might be something like:
function add_post($data) {
$this->db->insert('posts',$data);
}
Where $data is an array:
$data = array ('datetime'=>'2010-10-10 01:11:11', 'title'=>'test','body'=>'testing');
Is this best practice? It means if you use that function you need to know the names of the database fields where as my understanding of OOP is that you shouldnt need to know how the method works etc etc
It looks fine for starters. The basic idea is that the model is only interested in CRUD (create, retrieve, update & delete) of data between your application and your data store (i.e. your DB).
If you want to further abstract your database fields from the model itself, allowing it to create methods based on the fields automatically and so on, you can try an ORM (object-relational mapping) framework. A pretty simple one designed for CodeIgniter is IgnitedRecord.