calmchess Posted January 15, 2010 Share Posted January 15, 2010 I have an array holding data i want to loop through the array and display the data in an html table what would be the best way to do that? Link to comment https://forums.phpfreaks.com/topic/188578-array-data-to-table/ Share on other sites More sharing options...
Buddski Posted January 15, 2010 Share Posted January 15, 2010 Create a loop and output valid HTML table data Just kidding.. Do you have many cells? or is it just 1 cell here is a single cell example <table> <?php foreach ($arr as $value) { echo '<tr><td>'.$value.'</td></tr>'; } ?> </table> Link to comment https://forums.phpfreaks.com/topic/188578-array-data-to-table/#findComment-995592 Share on other sites More sharing options...
calmchess Posted January 15, 2010 Author Share Posted January 15, 2010 thank you here is some cool code if anybody has ":" as a data dilimiter in their array row data. <table id ="table0" border="1" cellspacing="0" cellpadding="3" width="350"> <?php foreach ($arr_unser as $value) {$plode0=explode(":",$value); echo'<tr><td width-"150">'.$plode0[0].'</td> <td width-"150">'.$plode0[1].'</td></tr>';} ?> </table> Link to comment https://forums.phpfreaks.com/topic/188578-array-data-to-table/#findComment-995602 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.