Jump to content

Recommended Posts

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

<?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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.