I want to get all the related pics corresponding to the pic selected....
here is my view page

<?php foreach($detail as $row){?>                                       
<img class="primary-image" ima="<?php echo base_url();?>images/<?php echo $row->image;?>" src="<?php echo base_url();?>images/<?php echo $row->image;?>" alt="" />                                          
<?php }?>

my control page looks like this....

public function product_details($p_id)
{
    $data['active_mn']='product_details';
    $data['product']=$this->roxmodel->get_product_details($p_id);
    $id = $this->input->post['category_id'];
    $data['detail']=$this->roxmodel->get_related_image($id,4,0);
    var_dump($data['detail']);
    $this->load->view('product_details',$data);
}

my model page looks like this

public function get_related_image($id,$limit,$offset)
{
    $this->db->select('*');
    $this->db->from('gallery');
    $this->db->join('category','category.id=gallery.category_id');
    $this->db->where('category_id',$id);
    $this->db->limit($limit,$offset);
    $query = $this->db->get();
    return $query->result();

}

here is my table-gallery(table name)

id     image                category_id         
93   img1455604030.jpg       10              
94   img1455605183.jpg       11               
95   img1455616291.jpg       11                
96   img1455617201.jpg       10                
97   img1455617299.jpg       10                
98   img1455681918.jpg       13              
99   img1455681957.jpg       12  

this is my code to view image by clicking

<a href="<?php echo base_url();?>roxcontrol/product_details/<?php echo $row->id; ?>/<?php echo $row->category_id; ?>">

my table contains shirts,tshirts,pants images and their corresponding category_ids are 10,11,12 when i choose the category_id=10 shirt image i want to get all category_id=10 shirt images under the related products and like that

the problem is category_id value is null iam not getting category_id value

Member Avatar for diafol
$id = $this->input->post['category_id'];

Check what that line gives

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.