Saturday, July 23, 2011

Re: [phpXperts] codeigniter and mysql inner join creating problem

 

function get_customer()
    {
       
        $this->db->select('*');
        $this->db->from('tbl_customer');   //remove it
        $this->db->join('tbl_sales', 'tbl_sales.customer_id = tbl_customer.customer_id');
        $query = $this->db->get('table_name');
        echo $this->db->last_query(); // add this  and see the query string, execute this in mysql
        exit();   // add this
        return $query->result();
    }
 
Thanks & Regards
Md. Abu Yusuf

IM: google:samba.yusuf
email: samba.yusuf@gmail.com
contact: +8801677171148
             +8801923245810
            




From: asma tuli <asmatuli@gmail.com>
To: phpexperts <phpexperts@yahoogroups.com>
Sent: Saturday, July 23, 2011 2:25 PM
Subject: [phpXperts] codeigniter and mysql inner join creating problem



my model


function get_customer()
    {
       
        $this->db->select('*');
        $this->db->from('tbl_customer');
        $this->db->join('tbl_sales', 'tbl_sales.customer_id = tbl_customer.customer_id');
        $query = $this->db->get();
        return $query->result();
    }

my controller


function index()
    {
      $this->load->model('sh_model');
      $variable['customer'] = $this->sh_model->get_customer();
      $this->load->view('sh_view', $variable); 
    }


my view


foreach($customer as $item)
                {
                        echo $item->customer_id;
                        echo $item->customer_first_name;
                }



I am getting no result.




__._,_.___
Recent Activity:
Visit phpXperts website at www.phpxperts.net
.

__,_._,___

No comments:

Post a Comment