+ Reply to Thread
Results 1 to 4 of 4

Thread: Making new rows

  1. #1

    Making new rows

    Hi All, This is my first post here at webmasterlingo.com. Yaaayyy!!!

    I have a small problem that needs solved and I'm running out of ideas to solve it, so I come to the members of this site seeking help.

    I have an html table that prints out info passed to it by MySQL. The problem is that some entries are more then 10. what I want it to do is when it hits the first ten, start a new row. So visually it looks like this.

    ----------------------------------------
    tex | text | text // this goes up to ten
    ----------------------------------------
    tex | text | text // this goes up to ten too
    ----------------------------------------

    And at that point I want it to create a new <tr></tr> for the rest of the entries

    Here is the code at the moment. It might be a little confusing but any help would be greatly appreciated.

    PHP Code:
                                    while ($count_against <= $count_rooms) {
                                    
    // this is where I want to tell it to start a new html table row when it hits 10
    if () {
                                    print 
    "<tr>\n";
                                    while (
    $count_against <= $count_rooms) {
                                    
    //while ($count_against <= 10) {
                                    
    print "<td width=\"75\" align=\"center\" valign=\"top\"><div class=\"mainTextMargin\">&nbsp;".$room_title[$count_against]."</div></td>";
                                                            
    $count_against++;
                                    }
                                    
    $width 75*$count_against-750;
                                    print 
    "<td width=".$width.">&nbsp;</td>";
                                    print 
    "</tr>\n";
                                    print 
    "<tr>";
                                    print 
    "<td height=\"1\" colspan=\"45\" class=\"tdBlack\"><img src=\"images/trans.gif\" width=\"1\" height=\"1\"></td>";
                                    print 
    "</tr>";
                                    print 
    "<tr>";
                                                        
    $count_against 0;
                                    while (
    $count_against <= $count_rooms) {
                                    
    //while ($count_against <= 10) {
                                    
    print "<td width=\"75\" align=\"center\" valign=\"top\"><div class=\"mainTextMargin\">&nbsp;".$room_dimensions[$count_against]."</div></td>";
                                                        
    $count_against++;
                                    }
                                    
    $width 75*$count_against-750;
                                    print 
    "<td width=".$width.">&nbsp;</td>";                                    
                                    print 
    "</tr>";
                                    }
                                    }
                                    
    ?> 

  2. #2
    Full Member dzone is on a distinguished road
    Join Date
    Dec 2003
    Posts
    75
    Try

    PHP Code:
    while ($count_against <= $count_rooms) { 
                                    
    // this is where I want to tell it to start a new html table row when it hits 10
    $n 0;
    if (
    $n 10) {
    ......... 
    your old code ....
    $n++;


  3. #3
    Thanks,

    I went about a different way less robust but it does the trick, so I'm gonna go ahead and test your way and some other ways this weekend and see what I can come up with.

    Thanks for the help

  4. #4
    Full Member kitty is on a distinguished road
    Join Date
    Aug 2005
    Posts
    16
    im agree with the one who send this code im tried it before
    while ($count_against <= $count_rooms) {
    // this is where I want to tell it to start a new html table row when it hits 10
    $n = 0;
    if (
    $n < 10) {
    .........
    your old code ....
    $n++;
    }

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Posting Permissions

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