I am a bit stuck.
I have the below controller function. this works 100% with no issues.
function new_blank_order_lines()
{
$data = array(
'project' =>$this->input->post('project'),
'millcoords' => $this->sales_model->get_mill_coords($this->input->post('mill')),
'custcoords' => $this->sales_model->get_cust_coords($this->input->post('deliveryaddressid')),
);
$this->load->view('sales/new_blank_order_lines',$data);
What I want to do is pass more model information to the view. my problem however is that I am needing the results of the previous model queries for my new model query. so I want to add to the array as follows:
$data = array(
'project' =>$this->input->post('project'),
'millcoords' => $this->sales_model->get_mill_coords($this->input->post('mill')),
'custcoords' => $this->sales_model->get_cust_coords($this->input->post('deliveryaddressid')),
'customersinrange' => $this->sales_model->get_customers_in_range($millcoords,$custcoords),
);
So I want to pass two values to the model function get_customers_in_range. I want to pass the results of millcoords
and the results of custcoords
.
How can I achieve this so that the controller can use the results of a model query to execute a new model query?
Thanks as always, Ryan
Try this:
function new_blank_order_lines()
{
$data = array();
$data['project'] = $this->input->post('project', true);
$data['millcoords'] = $this->sales_model->get_mill_coords( $this->input->post('mill') );
$data['custcoords'] = $this->sales_model->get_cust_coords($this->input->post('deliveryaddressid'));
$data['customersinrange'] = $this->sales_model->get_customers_in_range($data['millcoords'], $data['custcoords']);
$this->load->view('sales/new_blank_order_lines',$data);
$millcoords = $this->sales_model->get_mill_coords($this->input->post('mill');
$custcoords = $this->sales_model->get_cust_coords($this->input->post('deliveryaddressid');
$customersinrange = $this->sales_model->get_customers_in_range($millcoords,$custcoords);
$data = array(
'project' =>$this->input->post('project'),
'millcoords' => $millcoords,
'custcoords' => $custcoords,
'customersinrange' => $customersinrange,
);
$this->load->view('sales/new_blank_order_lines',$data);
Try this one:
$millcoords = $this->sales_model->get_mill_coords($this->input->post('mill'));
$custcoords = $this->sales_model->get_cust_coords($this->input->post('deliveryaddressid'));
$data = array(
'project' =>$this->input->post('project'),
'millcoords' => $millcoords,
'custcoords' => $custcoords,
'customersinrange' => $this->sales_model->get_customers_in_range($millcoords,$custcoords),
);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.