piznac Posted May 21, 2007 Share Posted May 21, 2007 Ok,.. I know I have seen this asked before. But after many searches and browsing the first ten pages here I am. This should be fairly simple though: Say I have an image database with image path & image name. Now normally I would do something like while(blah = blah){ echo "<tr><td>$row['path']</td><td>$row['name']</td></tr>"; } or something like that,. kinda in a rush here (at work and this has nothing to do with any work related projects .. lol) Now that would output something like this: 1.path | name 2.path | name 3.path | name 4.path | name etc.... what I would like is: 1.path | name 2.path | name 3.path | name 4.path | name any help? Sorry if this was rushed. If it dosent make any sense I will redo it tonight. Thanks! Link to comment https://forums.phpfreaks.com/topic/52381-solved-echoing-recordset-in-colums-rows/ Share on other sites More sharing options...
per1os Posted May 21, 2007 Share Posted May 21, 2007 <?php $i=0; while(blah = blah){ if (($i%2) == 0) { echo "<tr>"; }else { echo "</tr>"; } echo "<td>$row['path']</td><td>$row['name']</td>"; $i++; } ?> Something like that should work. May need some tweaking, untested. The % = modulous. Link to comment https://forums.phpfreaks.com/topic/52381-solved-echoing-recordset-in-colums-rows/#findComment-258477 Share on other sites More sharing options...
piznac Posted May 21, 2007 Author Share Posted May 21, 2007 Ok thanks I will look into this when I get home. I think I get it,.. thanks! Link to comment https://forums.phpfreaks.com/topic/52381-solved-echoing-recordset-in-colums-rows/#findComment-258479 Share on other sites More sharing options...
Barand Posted May 21, 2007 Share Posted May 21, 2007 see http://www.phpfreaks.com/forums/index.php/topic,139336.msg591593.html#msg591593 Link to comment https://forums.phpfreaks.com/topic/52381-solved-echoing-recordset-in-colums-rows/#findComment-258501 Share on other sites More sharing options...
piznac Posted May 22, 2007 Author Share Posted May 22, 2007 Thank you once again Barand,.. one of these days Im gonna get you that beer Link to comment https://forums.phpfreaks.com/topic/52381-solved-echoing-recordset-in-colums-rows/#findComment-259446 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.