I know there were similar threads but nothing seems to be helping in my case.
I have a multidimensional array which outputs nicely with the foreach loop if there are multiple elements
Array
(
[0] => Array
(
[amount] => 1
[productid] => IPAPER-BA-KI-001
[price] => 33
[name] => Backyard Exploration Playground Set
[description] => Whether your backyard is large or small, this play…
)
[1] => Array
(
[amount] => 1
[productid] => IPAPER-BI-KI-001
[price] => 4344
[name] => Bikerkids-Pro lightweight kids bicycle
[description] => The classic model of Bikerkids-Pro boy's and girl'…
)
)
Output:
Backyard Exploration Playground Set 33 1 Whether your backyard is large or small, this play…
Bikerkids-Pro lightweight kids bicycle 4344 1 The classic model of Bikerkids-Pro boy's and girl'…
But as soon as my array has only one element I get the following output
1 1 1 1 1
I I I I I
4 4 4 4 4
B B B B B
T T T T T
My code is here.
<H2>Item Details</H2>
<?php
echo '<table>';
foreach ($arrOutput['item'] as $mydata)
{
echo '<tr>';
echo '<td style="padding: 5px;">' . $mydata['id'] . '</td>';
echo '<td style="padding: 5px;">' . $mydata['name'] . '</td>';
echo '<td style="padding: 5px;">' . $mydata['price'] . '</td>';
echo '<td style="padding: 5px;">' . $mydata['amount'] . '</td>';
echo '<td style="padding: 5px;">' . $mydata['description'] . '</td>';
echo '</tr>';
}
echo '</table>';