Sunday, July 24, 2011

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

 

I think if you just pass the entire query to the query() function directly, its much faster and easier to debug.


For my queries, i use toad for mysql freeware, to build and test the queries and then pass them directly to the query functions. I avoid method chaining, as thats just couple more function call and  kinda hard to debug :)

Anyway its simply a matter of your choice how u do it.

On Sun, Jul 24, 2011 at 4:15 PM, Arif Mahmud Rana <rarifmahmudmr9@yahoo.com> wrote:
 

I suggest you to first implement with sql than try to implement it in codeigniter.

ARIF MAHMUD RANA


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.





--
Anjan Bhowmik
Freelance Software & Web Developer
M : +880 - 1670 - 556419
E : anjan011@gmail.cominfo@ultrasoftbd.com
Site: http://www.onlyfreelancer.com/ - Only for Freelancer's!

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

__,_._,___

No comments: