0

この連想配列を使用して、連想配列の項目を 2 列のテーブルに表示しようとしています
foreach($this->inventory as $ID => $Info)

"<table width ='100%'>\n"; 
 foreach($this->inventory as $ID => $Info) {
    echo"<tr>";   
    echo"<td>".$Info['name'] <br>$Info['description']." </td>";
    echo"<td>".$Info['name'] <br>$Info['description']."</td>"; 
    echo"</tr>";
}
</table>

問題は、各項目が各行に 2 回表示されることです。私はそれを次のように表示したい:

------------------------------------------------------------------
|Name: shoes                      |Name: bag
|Description: nike                |Description: swing bag
 -----------------------------------------------------------------
|Name: socks                      |Name: ear phones
|Description: black and white     |Description: beats
 -----------------------------------------------------------------
|Name: earrings                   |Name: phone
|Description: diamond  studs      |Description: blackberry  

しかし、私は代わりにこれを取得しています:

------------------------------------------------------------------
|Name: shoes                      | Name: shoes
|Description: nike                | Description: nike
 -----------------------------------------------------------------
|Name: bag                        | Name: bag 
|Description: swing bag           |Description: swing bag 
 -----------------------------------------------------------------
|Name: ear phones                 |Name: ear phones
|Description: beats               |Description: beats  
4

1 に答える 1