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