Remember to let your model return the records as an array of objects in order to use the object syntax in the view, like $post->id.
Otherwise, you must use the array syntax: $post['id'].
PHP Code:
$query = $this->db->order_by('datetime','ASC')->get('posts');
return $query->result(); // returns result as an array of objects, use ->result_array() to get an array of arrays