Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Aug 2010
    Posts
    405
    Thanks
    17
    Thanked 2 Times in 2 Posts

    echoing lists in two or three columns

    I'm hoping somebody can point me in the right direction. I have search results that display in a long-scrolling list. is there a way to have this echo into a new column of text every 20 results, for example?

    For reference, here's what i have now:
    Code:
    echo "<td valign=top width=190>title<br><font size=1>";
    while($row = mysql_fetch_array($quer4)) { 
    if($row[id]==@$cat){echo "<input type='checkbox' name='option1' value='$row[id]'>$row[Name] <BR>";}
    else{echo  "<input type='checkbox' name='option1' value='$row[id]'> $row[Name] <br>";}
    }
    echo "</font></td></tr></table>
    Last edited by turpentyne; 11-09-2011 at 11:21 PM.

  • #2
    Regular Coder mOrloff's Avatar
    Join Date
    Nov 2008
    Location
    The Great Pacific NW, USA
    Posts
    422
    Thanks
    8
    Thanked 6 Times in 6 Posts
    If you look at your problem sideways (figuratively :-), one option seems to really pop out.
    Since tables are drawn more from the row's perspective than the column's, why don't you just make more columns by adding more <td>'s in each of your <tr>'s.

    All you would need to do is decide how many columns you wanted and use a counter in your loops.

    Furthermore, if you needed your result set to look like it's flowing in columns rather than rows, break it out into a nested array.

    That is, unless I'm totally off here
    Surely someone with a better resume` can shed some light on the issue.
    ~ Mo
    ...because it's dundant already.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •