Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Jan 2007
    Thanked 0 Times in 0 Posts

    simple mysql data viewed by columns

    How do I make data (photos/content) output in columns?

    I've posted mysql data using $rows

    while($row = mysql_fetch_array($result))

    This worked great when I wanted to use rows to display the data.

    what I would like to do is make a simple code that would pull at the data from a Mysql DB query that would make 3 photos across and loop until all photos are displayed the DB.

    I'm in a bind with this. Any help would be appreciated

  • #2
    Super Moderator guelphdad's Avatar
    Join Date
    Mar 2006
    St. Catharines, Ontario Canada
    Thanked 148 Times in 139 Posts
    use a counter and the MODULUS operator (%). check the counter like this:

    PHP Code:
    if (($counter 3) == 0) {
    "your next item here";
    } else {
    "your next item here";

    that would close your table cells. you will have to fiddle with your html code but the modulus example is what you need a hint on.
    Last edited by guelphdad; 02-22-2007 at 08:51 PM.


    Posting Permissions

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