6. /application/models/FlowerModel.php
<?php
class FlowerModel extends CI_Model {
function getFlowers(){
$query=$this->db->get('flori');
return $query->result();
}
function getFlower($id){
$this->db->where('id',$id);
$query = $this->db->get('flori');
return $query->row();
}
}
7. /application/controllers/FlowerController.php
<?php
class FlowerController extends CI_Controller {
function __Construct(){
parent::__Construct ();
$this->load->model('FlowerModel','f'); // load model
}
public function index() {
$this->load->view('flowers_view');
}
public function view($id=NULL){
$row=$this->f->getFlower($id);
$data['r']=$row;
$this->load->view('single_flower_view',$data);
}
}}