Welcome Guest, Not a member yet? Register   Sign In
db_join adds new record to left table
#3

Thank you!

This is the result of last_query(): (captured right before the return in the model function)
Code:
SELECT `tincture`.*, `ps_product_lang`.`name` as `ps_name`, `tincture`.`name` as `tincture_name` FROM `tincture` LEFT JOIN `ps_product_lang` ON `tincture`.`ps_product_id` = `ps_product_lang`.`id_product` GROUP BY `tincture`.`tincture_id`

This is the result of print_r($query->result()): (already inserted one record)
Code:
Array ( [0] => stdClass Object ( [tincture_id] => 1 [ps_product_id] => 13 [name] => Sibirian Ginseng [is_product] => 1 [ps_name] => Siberian Ginseng [Eleutherococcus senticosus] [tincture_name] => Sibirian Ginseng ) [1] => stdClass Object ( [tincture_id] => 2 [ps_product_id] => 10 [name] => Pau d'Arco [is_product] => 1 [ps_name] => Pau d'Arco [Tabebuia impetiginosa] [tincture_name] => Pau d'Arco ) [2] => stdClass Object ( [tincture_id] => 3 [ps_product_id] => 1 [name] => Cat's Claw [is_product] => 1 [ps_name] => Cat's Claw uña de gato [Uncaria tomentosa] [tincture_name] => Cat's Claw ) [3] => stdClass Object ( [tincture_id] => 44 [ps_product_id] => 1 [name] => Cat's Claw [is_product] => 1 [ps_name] => Cat's Claw uña de gato [Uncaria tomentosa] [tincture_name] => Cat's Claw ) [4] => stdClass Object ( [tincture_id] => 45 [ps_product_id] => 1 [name] => Cat's Claw [is_product] => 1 [ps_name] => Cat's Claw uña de gato [Uncaria tomentosa] [tincture_name] => Cat's Claw ) )

here is the controller:
Code:
function index()
    {
            $this->tincture_over_view();
            return(0);
    }
    
    function tincture_over_view()    
    {
        $data = array();
        
        if($query = $this->tincture_model->get_records())
        {
            $data['title'] = 'Tinctures';
            $data['admin_head'] = $this->load->view('templates/admin_head', $data, TRUE);
            $data['admin_top_bar'] = $this->load->view('templates/admin_top_bar', $data, TRUE);
            $data['admin_header'] = $this->load->view('templates/admin_header', $data, TRUE);
            $data['admin_footer'] = $this->load->view('templates/admin_footer', $data, TRUE);
            $data['title_action'] = 'Manage Tinctures';
            $data['top_note'] = 'List of your tinctures.';
            $data['records'] = $query;    
            
//            print_r($data);
            
            $this->load->view('tincture/tincture_over_view', $data);
        }
        else
        {

            $this->tincture_create();
        }
    }
Reply


Messages In This Thread
RE: db_join adds new record to left table - by alfred.laggner - 01-22-2015, 01:10 PM



Theme © iAndrew 2016 - Forum software by © MyBB