Welcome Guest, Not a member yet? Register   Sign In
why all queries fire twice?
#1
Question 
(This post was last modified: 07-16-2016, 06:53 AM by jaynarayan.)

   
why all queries fire twice? i am using jamie rumbelow's MY_model as base model. see the attachment

 this is my controllers index method:
PHP Code:
public function index($page 0)
    {

        $this->load->library('pagination');

        $config['base_url'] = base_url() . 'masters/hourly_budget/index';
        $config['total_rows'] = $this->hourly_budget_model->count_all();
        $config['per_page'] = 10;
       
 $config
['cur_page'] = $this->uri->segment(4);

 $this->pagination->initialize($config);
        $hourly_budget $this->hourly_budget_model->limit($config['per_page'], $config['cur_page'])->get_all();

        $data['page_links'] = $this->pagination->create_links();
        $data['hourly_budget_data'] = $hourly_budget;
        $data['sr'] = $page;
        $this->template->render($this->default_layout'hourly_budget/hourly_budget_list_view'$data);
    
model:


PHP Code:
<?php 
defined
('BASEPATH') OR exit('No direct script access allowed');


/**
 * Description of hourly_budget_model
 *
 * @author
 */
class hourly_budget_model extends MY_Model {
   protected $_table ="hourly_budget";
    
   

          Heart  love codeigniter Heart
          Learning  best  practices
     Rate my post if you found it helpfull
Reply
#2

Show us the code, without the code we do not know what could be wrong
Reply
#3

Your showing the Controller code, show the Model code.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#4

(07-16-2016, 04:20 AM)InsiteFX Wrote: Your showing the Controller code, show the Model code.

my_model  is jemie rumbelow's base model.
          Heart  love codeigniter Heart
          Learning  best  practices
     Rate my post if you found it helpfull
Reply
#5

You need to create your own model extending his MY_Model once you load your extended model all of his methods should work.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#6

(07-16-2016, 01:16 PM)InsiteFX Wrote: You need to create your own model extending his MY_Model once you load your extended model all of his methods should work.

yes i am .
check the updated code.

**************
it seems like there is multiple instance of $db. queries are not running twice. profiler is showing it two times. if there is no query running on page profiler displays two database column

Attached Files Thumbnail(s)
   
          Heart  love codeigniter Heart
          Learning  best  practices
     Rate my post if you found it helpfull
Reply




Theme © iAndrew 2016 - Forum software by © MyBB