Welcome Guest, Not a member yet? Register   Sign In
How query generates in controller,, without any function call to loaded Model ?
#1

Hello, Hi to all

i am some novice ,

i have FusionInvoice from Github, i am unable to understand, how its controller is getting query result from model, where the function not exist in model.

in its Quotes/Create Quote Modal,  Client Name filed has .TypeAhed plugin,

Client Name : $.post("<?php echo site_url('clients/ajax/name_query'); ?>"

The Clients/Ajax Controller has function


PHP Code:
 public function name_query()
    {
        // Load the model
        $this->load->model('clients/mdl_clients');

        // Get the post input
        $query $this->input->post('query');

        $clients $this->mdl_clients->select('client_name')->like('client_name'$query)->order_by('client_name')->get(array(), FALSE)->result();

        $response = array();

        foreach ($clients as $client)
        {
            $response[] = $client->client_name;
        }

        echo json_encode($response);
    

But the mdl_clients  has no "select" function defined,, 
but yes , there is a function called  "default_select",  but its totally different than the one passed as in above controller to $clients.

the default_select in mdl_cleints is as following
 
PHP Code:
public function default_select()
    {
        $this->db->select('SQL_CALC_FOUND_ROWS fi_client_custom.*, fi_clients.*'FALSE);
    

Can any one help please how controller is getting query data ?  As in controller,, only field name is given in query, without table name,, so how its doing then ?

Any help will be appericiated
Thanks
Reply


Messages In This Thread
How query generates in controller,, without any function call to loaded Model ? - by Haseeb - 03-18-2018, 11:34 PM



Theme © iAndrew 2016 - Forum software by © MyBB