Php未定义偏移量:0 1 2 3 4 5 6等

时间:2014-04-25 02:12:05

标签: javascript php html codeigniter

我需要一些帮助..希望你们能帮助我。我是这个网站的新成员。提前谢谢。

严重性:注意

消息:未定义的偏移量:0

文件名:models / atmlist_bybranch_model.php

行号:103

此错误从

开始
$results = $data[$i]["collectReceivables"] >= $data[$i] "totalDeposit"]?1:0;                    

$html .="<td>".$data[$i]["createdDate"]."</td>";
$html .="<td>".$data[$i]["clientID"]."</td>";
$html .="<td>".$data[$i]["lname"]." ".$data[$i]["fname"]." ".$data[$i]["mname"]."</td>";

$html .="<td>".$data[$i]["clientBankLoc"]."</td>";
$html .="<td>".$data[$i]["pensionDate"]."</td>";

这是我的查询:

$index = 0;

$data = array();            
foreach($query->result() as $row){
    $data[$row->clientID][$row->trans_type][$index]=array(
                "createdDate" =>$row->createdDate,
                "trans_type" =>$row->trans_type,
                "clientID" =>$row->clientID,
                "fname" =>$row->fname,
                "mname" =>$row->mname,
                "lname" =>$row->lname,
                "pensionDate" =>$row->pensionDate,
                "clientBankLoc" =>$row->clientBankLoc,
                "loanLedgerID" =>$row->loanLedgerID,
            );


    $this->db->select("cl.collectionDepositAmount");    
    $this->db->from("collections_ledger cl");
    $this->db->where("cl.loanLedgerID", $row->loanLedgerID);
    $this->db->where("cl.createdDate >= ", strtotime($fullStartDate));
    $this->db->where("cl.createdDate <= ", strtotime($fullEndDate."+1 day"));   
    $query2 = $this->db->get();

    $totalCollection = 0;
    foreach($query2->result() as $row2){
        $data[$row->clientID][$row->trans_type][$index]["collectionDepositAmount"][] = $row2->collectionDepositAmount;
        $totalCollection += $row2->collectionDepositAmount;
    }           
    $data[$row->clientID][$row->trans_type][$index]["totalDeposit"] = $totalCollection;


    $this->db->select("collectionReceivables");
    $this->db->from("collections");
    $this->db->where("loanledgerID", $row->loanLedgerID);
    $query3 = $this->db->get();

    $totalReceivables = 0;
    foreach($query3->result() as $row3){
        $data[$row->clientID][$row->trans_type][$index]["collectionReceivables"][] =$row3->collectionReceivables;
        $totalReceivables += $row3->collectionReceivables;
    }
    $data[$row->clientID][$row->trans_type][$index]["collectReceivables"] = $totalReceivables;
    $index++;
}                   

$results = 0;
$x = 0;
for($i=0; $i<count($data); $i++){

    $results = $data[$i]["collectReceivables"] >= $data[$i]["totalDeposit"]?1:0;                                
    $html .="<tr>";
    $html .="<td>".($x +1)."</td>";
    $html .="<td>".$data[$i]["createdDate"]."</td>";
    $html .="<td>".$data[$i]["clientID"]."</td>";
    $html .="<td>".$data[$i]["lname"]." ".$data[$i]["fname"]." ".$data[$i]["mname"]."</td>";                
    if($results == 1){
        $html .="<td>IN</td>";                  
    }else{
        $html .="<td>OUT</td>";                 
    }
    $html .="<td>".$data[$i]["clientBankLoc"]."</td>";
    $html .="<td>".$data[$i]["pensionDate"]."</td>";
    $html .="</tr>";        
    $x++;
}

1 个答案:

答案 0 :(得分:0)

用空字符串替换所有[$row->clientID][$row->trans_type](即删除它)