johnnyblaze9 Posted April 21, 2008 Share Posted April 21, 2008 How do I create a table in html using my sql database and php? Link to comment https://forums.phpfreaks.com/topic/102217-creating-a-table-in-html/ Share on other sites More sharing options...
DarkWater Posted April 21, 2008 Share Posted April 21, 2008 Set up a new row on every iteration of a while loop that gets the MySQL results. I'll post an example if you don't get it. Link to comment https://forums.phpfreaks.com/topic/102217-creating-a-table-in-html/#findComment-523250 Share on other sites More sharing options...
Styles2304 Posted April 21, 2008 Share Posted April 21, 2008 just a quick example: <table width="100%" cellpading="0" cellspacing="0" border="0"> <?php $query = "SELECT Data FROM Main ORDER BY RAND() LIMIT 5"; $result = mysql_query($query, $link) or die(mysql_error()); $main = ' '; while ($row = mysql_fetch_array($result)) { $Data = $row['Data']; $main .=<<<EOD <tr> <td> $Data </td> </tr> EOD; } echo $main; ?> </table> Link to comment https://forums.phpfreaks.com/topic/102217-creating-a-table-in-html/#findComment-523259 Share on other sites More sharing options...
johnnyblaze9 Posted April 21, 2008 Author Share Posted April 21, 2008 Thanx! Link to comment https://forums.phpfreaks.com/topic/102217-creating-a-table-in-html/#findComment-523286 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.