Welcome Guest, Not a member yet? Register   Sign In
Get Images of an Article
#1

Hello there,

I'm new to Codeigniter and to this forum as well.

I'm trying to publish my articles (products). On any product page there will be a gallery showing the related images about the product. I've tried the JOIN method below upon a tutorial, however I cannot fetch all the photos. How can I get all the images and show them like a photo gallery?

My Gallery table has a "imageproductid" column on which I make the join for "product"

My DB :


PHP Code:
function singleproduct($a)
    {
        $this->db->select('*');
        $this->db->from('products');
        $this->db->where('productslug'$a);
    
        $this
->db->join('gallery''gallery.imageproductid=productid' );
        $myresult=$this->db->get()->row();
        return $myresult;
    



My Controller:


PHP Code:
public function products($link)
    {
        $this->load->model('mydb');
        $result $this->mydb->singleproduct($link);
        $data['information']=$result;

        $this->load->view('product'$data); 


My View:
 
Code:
<img src="<?php echo base_url($information->imagepath);?>" class="max"/>
Reply


Messages In This Thread
Get Images of an Article - by demyr - 09-16-2018, 06:07 AM
RE: Get Images of an Article - by jreklund - 09-16-2018, 09:46 AM
RE: Get Images of an Article - by demyr - 09-16-2018, 10:45 PM
RE: Get Images of an Article - by php_rocs - 09-17-2018, 07:49 AM
RE: Get Images of an Article - by Wouter60 - 09-17-2018, 08:42 AM
RE: Get Images of an Article - by demyr - 09-27-2018, 12:47 AM
RE: Get Images of an Article - by Pertti - 09-27-2018, 01:15 AM



Theme © iAndrew 2016 - Forum software by © MyBB