dongtao1262 2017-06-02 17:46
浏览 30

这个PHP让我抓狂[重复]

i am getting this error at "$hourtominute = date('H',strtotime($qData\[0\]\['totaltime'\]))*60;" and it wont tell me where the error is. Its just redmarked. can you please help me. if ur not understanding it please let me know so i can be more exactly. the code has been working for 4 years until last months. cant see why its giving me this error. i did post a picture aswell.

Here is the image

<?php 
$model = Passivatelog::model();
if(!empty($myValue)) { 
    //var_dump($myValue);

    $oPsv = Passivatelog::model();
    $oPsvRep = PassivatelogReport::model();

    $aReport = $oPsvRep->getReportByMachineId($myValue['report_machine']);
    $operator = $aReport['report_operator'];
    $machine = $aReport['report_machine'];
    $date = $aReport['report_date'];

    $aGroupedSteps = $model->getAllSteps();
?>
<div class="col-lg-6">
        <table class="table table-bordered">
            <tr>
                <th>Operator:</th>
                <th>Maskinnummer:</th>
                <th>Datum:</th>
            </tr>
            <tr>
                <td><?php echo $operator;?></td>
                <td><?php echo $machine;?></td>
                <td><?php echo $date; ?></td>
            </tr>
        </table>
        </div>
<div class="col-lg-12">
  <table class="table table-striped">
            <thead>
                <tr><th></th><th colspan="2">Temperatur</th><th colspan="2">PH Värde</th><th>Konduktivitet</th><th colspan="3">Tid</th></tr>
                <tr><th>Process</th><th>Start</th><th>Stop</th><th>Startvärde</th><th>Diff In/Ut</th><th>Medel</th><th>Start</th><th>Stop</th><th>Totaltid minuter</th></tr>
            </thead>
<?php            
    foreach($aGroupedSteps as $gstep) {
        $qData = $oPsv->getAllData($gstep->log_processname, $aReport['report_date'], $aReport['report_from'], $aReport['report_to']);
                $hourtominute = date('H',strtotime($qData[0]['totaltime']))*60;
                $minutetominute = date('i',strtotime($qData[0]['totaltime']));
                $totaltime = $hourtominute+$minutetominute;
                echo '
            <tr>
                <td>' . $gstep->log_processname . '</td>
                <td>'.$qData[0]['starttemp'].'</td>
                <td>'.$qData[0]['endtemp'].'</td>
                <td>'.(($qData[0]['startph']>0)? $qData[0]['startph']:'').'</td>
                <td>'.(($qData[0]['diffph']>0) ? number_format($qData[0]['diffph'],2) : '' ).'</td>
                <td>'.(($qData[0]['conductivity']>0)? number_format($qData[0]['conductivity'],0) : '').'</td>
                <td>'.$qData[0]['starttime'].'</td>
                <td>'.$qData[0]['endtime'].'</td>
                <td>'.$totaltime.'</td>
            </tr>';
    }
   ?> 
<tfoot></tfoot>
        </table>
</div>
<div class="clearfix"></div>
<?php
} else {
    $oPsv = Passivatelog::model();
    $oPsvRep = PassivatelogReport::model();

    $aReport = $oPsvRep->getLatestReport();
    var_dump($aReport);
    $operator = $aReport['report_operator'];
    $machine = $aReport['report_machine'];
    $date = $aReport['report_date'];
    $aGroupedSteps = $model->getAllSteps();
    if(!empty($aGroupedSteps) && !empty($aReport)) {
?>
<div class="col-lg-6">
        <table class="table table-bordered">
            <tr>
                <th>Operatör:</th>
                <th>Maskinnummer:</th>
                <th>Datum:</th>
            </tr>
            <tr>
                <td><?php echo $operator;?></td>
                <td><?php echo $machine;?></td>
                <td><?php echo $date; ?></td>
            </tr>
        </table>
        </div>
<div class="col-lg-12">
  <table class="table table-striped">
            <thead>
                <tr><th></th><th colspan="2">Temperatur</th><th colspan="2">PH Värde</th><th>Konduktivitet</th><th colspan="3">Tid</th></tr>
                <tr><th>Process</th><th>Start</th><th>Stop</th><th>Startvärde</th><th>Diff In/Ut</th><th>Medel</th><th>Start</th><th>Stop</th><th>Totaltid minuter</th></tr>
            </thead>
            <tbody>
<?php
        foreach($aGroupedSteps as $gstep) {
                $qData = $oPsv->getAllData($gstep->log_processname, $aReport['report_date'], $aReport['report_from'], $aReport['report_to']);
                $hourtominute = date('H',strtotime($qData[0]['totaltime']))*60;
                $minutetominute = date('i',strtotime($qData[0]['totaltime']));
                $totaltime = $hourtominute+$minutetominute;
                echo '
            <tr>
                <td>' . $gstep->log_processname . '</td>
                <td>'.$qData[0]['starttemp'].'</td>
                <td>'.$qData[0]['endtemp'].'</td>
                <td>'.(($qData[0]['startph']>0)? $qData[0]['startph']:'').'</td>
                <td>'.(($qData[0]['diffph']>0) ? number_format($qData[0]['diffph'],2) : '' ).'</td>
                <td>'.(($qData[0]['conductivity']>0)? number_format($qData[0]['conductivity'],0) : '').'</td>
                <td>'.$qData[0]['starttime'].'</td>
                <td>'.$qData[0]['endtime'].'</td>
                <td>'.$totaltime.'</td>
            </tr>';

        }
        ?>
            <tbody>
            <tfoot></tfoot>
        </table>           
</div>
<div class="clearfix"></div>
            <?php
    }
}
</div>
  • 写回答

1条回答 默认 最新

  • duanche9384 2017-06-02 18:50
    关注

    Data stored in array: $qData[0]['totaltime'] is not of correct format to be converted to time.

    Check strtotime function in PHP manual (http://php.net/manual/en/function.strtotime.php) to check for the correct format of the string to be converted and check the data stored in that array whether it matches any of the mentioned formats in the manual.

    You may need to cleanse your data, so that it works again, given it used to work before (as you have mentioned) but suddenly stopped working. It is a data related issue.

    Hope this helps.

    评论

报告相同问题?

悬赏问题

  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 stm32开发clion时遇到的编译问题
  • ¥15 lna设计 源简并电感型共源放大器
  • ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)