abhikerl Posted August 19, 2009 Share Posted August 19, 2009 Hi, I want to display a data so that it appears as follows: <tr><td> 1</td>2</td></tr> <tr><td> 3</td>4</td></tr> <tr><td> 5</td>6</td></tr> I want that after an amount of record being displayed, it automatically add the next record on different row. Can anyone help me, plz..am new to php and still learning..thanks. Quote Link to comment https://forums.phpfreaks.com/topic/170983-display-new-row-problem/ Share on other sites More sharing options...
MadTechie Posted August 19, 2009 Share Posted August 19, 2009 What do you have so far ? Quote Link to comment https://forums.phpfreaks.com/topic/170983-display-new-row-problem/#findComment-901810 Share on other sites More sharing options...
kayess2004 Posted August 19, 2009 Share Posted August 19, 2009 Hi, One way you could try would be as follows: // Database stuff here $count = 0; echo "<tr>"; while($row = mysql_fetch_array($query)) { if($count == 2) { echo "</tr><tr>"; $count = 0; } echo "<td>" . $row['result'] . "</td>"; $count++; } echo "</tr>"; Hope this helps Quote Link to comment https://forums.phpfreaks.com/topic/170983-display-new-row-problem/#findComment-901812 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.