foreach ループを実行すると、3 つのリスト項目の空のリストが表示されるだけです。
配列を印刷すると、次のようになります->
Array
(
[1] => Array
(
[id] => 10
[orderinfo] => Array
[userid] => 210
[date] => 2013-06-20 13:46:27
)
[2] => Array
(
[id] => 18
[orderinfo] => helo
[userid] => 210
[date] => 2013-06-20 15:04:58
)
[3] => Array
(
[id] => 19
[orderinfo] => {"order":[{"id":"2","name":"Basil Cress","qty":"1"},{"id":"4","name":"Sakura Mix","qty":"1"},{"id":"6","name":"Beetroot Shoots","qty":2},{"id":"28","name":"Celery","qty":2},{"id":"24","name":"Orange Capsicums","qty":"1"}]}
[userid] => 210
[date] => 2013-06-20 15:06:46
)
)
これまでの私のコード..
foreach ($orderdata as $item) {
$orderinfo = json_decode($item->orderinfo, true);
$orderitem[] = array(
'date' => $item->date,
'productname' => $orderinfo['name'],
'productqty' => $orderinfo['qty'],
);
}
echo "<pre>";
print_r($orderdata);
echo "</pre>";
?>
<?php foreach ($orderitem as $orderitems) { ?>
<li>
<?php echo $orderitems['date']; ?>
</li>
<?php }; ?>