【发布时间】:2013-10-10 08:48:11
【问题描述】:
我有点卡住了。
我有以下控制器功能。这 100% 没有问题。
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);
我想做的是将更多模型信息传递给视图。但是,我的问题是我的新模型查询需要以前模型查询的结果。所以我想按如下方式添加到数组中:
$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),
);
所以我想将两个值传递给模型函数 get_customers_in_range。我想传递millcoords的结果和custcoords的结果。
我怎样才能做到这一点,以便控制器可以使用模型查询的结果来执行新的模型查询?
一如既往的感谢, 瑞恩
【问题讨论】:
-
您可以使用在您使用的模型函数中访问必要的模型函数调用,而不是将一个模型查询的结果用于另一个内部控制器。
标签: php database codeigniter model