douhuan9289
2014-06-21 07:26
浏览 113
已采纳

数组中未定义的索引错误

var_dump:

array (size=2)
0 => 
array (size=16)
  'campaignID' => string '416' (length=3)
  'trackerID' => string '401' (length=3)
  'bannerID' => string '9901193' (length=7)
  'CookieID' => string '7ed9340d8f971e1a396afc3e01fb3ab7' (length=32)
  'affiliateid' => int 1782
  'ConversionConnectionID' => string '6712988' (length=7)
  'conversionTime' => string '2014-06-14 09:09:18' (length=19)
  'conversionStatus' => string 'Pending' (length=7)
  'userIp' => string '27.0.57.16' (length=10)
  'actionkey' => string 'gte500' (length=6)
  'window' => int 20410
  'variables' => 
    array (size=9)
      'cartvalue' => string '752.53' (length=6)
      'clickid' => string '' (length=0)
      'conversionid' => string '' (length=0)
      'event' => string '' (length=0)
      'leadid' => string '' (length=0)
      'optionaladver' => string 'producttype,saleamount,modeofpayment' (length=36)
      'quantity' => string '' (length=0)
      'timestamp' => string '1970-01-01 00:00:00' (length=19)
      'transactionid' => string '1107063NJP517A934' (length=17)
  'sub_conversion' => int 0
  'updated_date' => string '0000-00-00 00:00:00' (length=19)
  'sum_affiliate_commission' => float 125
  'type' => string 'Sale' (length=4)
'TotalRows' => int 1

I am going to print the data from this array using following code:

<?php foreach ($results as $licenseElement) :?>
<tr>
  <td><?php echo $licenseElement['campaignID']; ?></td>
  <td><?php echo $licenseElement['trackerID']; ?></td>
  <td><?php echo $licenseElement['conversionTime']; ?></td>
  <td><?php echo $licenseElement['userIp']; ?></td>
</tr>
<?php endforeach; ?>

But it gives me an error of Undefined index: for all columns.

What's wrong with my code?

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

2条回答 默认 最新

相关推荐 更多相似问题