【发布时间】:2018-12-30 09:22:19
【问题描述】:
我正在使用 Code Igniter,我尝试将 $finalamount 添加到 result_array。
$this->db->select('customer_id, customer_ref, i_points, group_points, created_on');
$run_q = $this->db->get('employees');
if($run_q->num_rows() > 0){
foreach ($run_q->result_array() as $get) {
$totalpoints = $get['i_points'] + $get['group_points'];
$percent = 17;
$amountbycustomer = $totalpoints * 26 * $percent;
$amountbypref = $this->final($get['customer_id'],$percent);
$finalamount = $amountbycustomer + $amountbypref;
$get['finalamount'] = $finalamount;
}
return $run_q->result_array();
}
但在我看来,这个错误
<td class="employeeCustomer"><?=$get['customer_id']?></td>
<td class="employeeCustomerRef"><?=$get['customer_ref']?></td>
<td class="employeeAmount"><?=$get['finalamount']?></td>//line 65
消息:未定义的索引:finalamount
文件名:employees/employeeslist.php
行号:65
【问题讨论】:
标签: php mysql codeigniter model-view-controller