0

在我的模型中:

function input()
{
    $vendor = $this->input->post('vendor');
    for($i=1;$i<=$vendor;$i++)
    {
        for($j=1;$j<=$vendor;$j++)
        {
            $delivery[$j] = $this->input->post('delivery_1_'.$j.'_'.$i);
            $totalsatu[$i]  = array_sum($delivery);
        }
        for($k=1;$k<=$vendor;$k++)
        {
            $delivery[$k] = $this->input->post('delivery_1_'.$k.'_'.$i);
            $totaldua[$i] = $totalsatu[$i] / $delivery[$k];
        }
    }
    return array
    (
        'result1' => $totalsatu,
        'result2' => $totaldua
    );
}

在我的views,我打电话给$result1and$result2但我不断收到如下错误:

Message: Division by zero

Filename: models/core.php

Line Number: 113

这是 113 的行号:

$totaldua[$i] = $totalsatu[$i] / $delivery[$k];
4

0 回答 0