I am new to codeigniter and still learning. I want to show a single product from my database containing the table product which includes product_id,product_name etc tables.I have come up with a problem below
A PHP Error was encountered
Severity: Notice
Message: Undefined variable: id
Filename: controllers/mysite.php
Line Number: 37
Below is my controller :
public function product()
{   
    $this->load->model('products');
    $data['rows3'] = $this->products->product($id);
    $this->load->view('mysite/include/product-left');
    $this->load->view('mysite/product-content',$data);
    $this->load->view('mysite/include/product-related');
    $this->load->view('mysite/include/footer');
}
Below is my model
<?php
 class products extends CI_Model{
   function product($id){
    $q3 = $this->db->query("SELECT * FROM product WHERE product_id  ='".$id."'");
    if($q3->num_rows() > 0){
        foreach($q3->result() as $row){
           $data[] = $row;
        }
        return $data;
        }       
    }   
}
Now i am really confused where to use that id, what am i missing. please help.
 
     
     
    