adi123 Posted August 27, 2010 Share Posted August 27, 2010 I am trying to display data from mysql. Each row from the mysql database shows up under rows. I want the rows of data from mysql to appear in colums of 4. can some one help please. <?php $sql = 'SELECT * FROM dbtable ORDER BY id'; $result = $db->query($sql); $output[] = '<ul>'; while ($row = $result->fetch()) { $output[] = '<table>'; $output[] = '<tr>'; $output[] = '<td class="style10"><strong>'.$row['item'].'</strong></td>'; $output[] = '</tr>'; $output[] = '<tr>'; $output[] = '<td><img src="images/'.$row['pic'].'" width="100" height="150" /></td>'; $output[] = '</tr>'; $output[] = '<tr>'; $output[] = '<td>'.$row['description'].'</td>'; $output[] = '</tr>'; $output[] = '</table>'; } echo join('',$output); ?> Link to comment https://forums.phpfreaks.com/topic/211885-insert-data-from-mysql-database/ Share on other sites More sharing options...
wildteen88 Posted August 27, 2010 Share Posted August 27, 2010 Sure, Look at Multi-column Results FAQ Link to comment https://forums.phpfreaks.com/topic/211885-insert-data-from-mysql-database/#findComment-1104378 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.