Im pulling some data from an xml on a separate site and trying to display that data in a table, i can pull the data but when i tried to display the data in a table for each row i got the table headers, now i know why this is happening (because the table header echo is being called for every row) but i cant see how to fix it.
<?php
$url = "http://elcu.herobo.com/testarea/include/cd_catalog.xml";
$xml = simplexml_load_file($url);
foreach($xml->CD as $cd){
echo "<table border='0' cellpadding='1' cellspacing='1' width'90%' id='1' class='tablesorter'><thead><tr> <th>Title</th> <th>Artist</th> <th>Company</th><th>Price</th></thead><tbody>";
echo "<td width='25%'> ".$cd->TITLE."</td>";
echo "<td width='25%'> ".$cd->ARTIST."</td>";
echo "<td width='25%'> ".$cd->COMPANY."</td>";
echo "<td width='25%'> ".$cd->PRICE."</td>";
echo "</tbody></table>";
}
?>
You mean:
Note that you called
tableinside your foreach loop, and you also didn’t specify the start and end of the row withtr