2016-02-28 109 views
0

错误是:错误 “时遇到一个PHP错误”

Error 
A PHP Error was encountered 
Severity: Notice 
Message: Undefined offset: 0 
Filename: admin/orders.php 

在哪里我的错误?

<div class="panel panel-default"> 
    <div class="panel-heading"><h6 class="panel-title">Заказы</h6></div> 
    <div class="table-responsive"> 
     <table class="table table-striped table-bordered"> 
    <thead> 
     <tr> 
       <th>ID</th> 
       <th>Примечание</th> 
     <th>Дата</th> 
       <th>Товар</th> 
      <th style="min-width:70px;">Кол-во</th> 
       <th>Цена</th> 
      <th>E-mail</th> 
       <th>IP</th> 
      <th>Скачать</th> 
      </tr> 
     </thead> 
     <tbody> 
<? if(count($orders)): 
     foreach($orders as $order): ?> 
      <tr> 
      <td><? echo $order->id; ?></td> 
       <td><? echo $order->bill; ?></td> 
       <td style="font-size:11px;"><? echo date('d-m-Y H:i:s',$order->date); ?></td> 
      <td style="font-size:11px;"><? echo $order->name; ?></td> 
     <td><? echo $order->count; ?></td> 
    <td><? echo $order->price.' '.$order->fund; ?></td> 
       <td><? echo $order->email; ?></td> 
       <td><? echo $order->ip_address; ?></td> 
      <td> 
       <a download="" href="/payorder/<? echo $order->bill; ?>.txt" class="btn btn-default btn-icon btn-xs tip" title="" data-original-title="Скачать купленный товар"><i class="fa fa-download"></i></a> 
       </td> 

      </tr> 
<?  endforeach; ?> 
<? else: ?> 
      <tr> 
       <td colspan="8">Покупки отсутствуют</td> 
      </tr> 
<? endif; ?> 
     </tbody> 
     </table> 
    </div> 
</div> 
+1

我加入你的代码的问题,你应该做的。现在你可以尝试格式化它,使其可读,不必介意我也这样做 – RiggsFolly

+0

你确定错误发生在这个脚本的其中一行吗? – RiggsFolly

+0

遇到PHP错误 严重性:通知 消息:未定义偏移量:0 文件名:admin/orders.php 行号:25 –

回答

0

它看起来介于订单它不是拿起它和秩序是空白,

试试这个

if(isset($orders)) { 
//Your code here. 
}