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 3 of 3
  1. #1
    New Coder
    Join Date
    May 2006
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Split one long row into columns ?

    I have been trying to get this code if over a certain size to display in another row but to no avail...

    Here is the code..
    Code:
    $c=@mysql_data_seek($catquery,0);
    
    if($c) {
     echo "<div class='tableborder'><table><tr>";
    while ($c = mysql_fetch_array($catquery)) {
    
    echo  "<td width='5%' align='center' class='arcade1'><a href='Arcade.php?cat=$c[0]'>$c[1]</a></td>";
    } 
    echo"</tr></table></div>";
    echo "<br />";
    }
    Any help would be greatly appreciated.

    TY
    BoN

  • #2
    Regular Coder
    Join Date
    May 2006
    Location
    Wales
    Posts
    820
    Thanks
    1
    Thanked 82 Times in 79 Posts
    PHP Code:
    $c=@mysql_data_seek($catquery,0);
    $cols 5// number of columns

    if($c) {
     echo 
    "<div class='tableborder'><table>";
    $i 0;
    while (
    $c mysql_fetch_array($catquery)) {
    if (
    $i == 0) echo "<tr>";
    echo  
    "<td width='5%' align='center' class='arcade1'><a href='Arcade.php?cat=$c[0]'>$c[1]</a></td>";
    $i++;
    if (
    $i == $cols){
    $i 0;
    echo 
    '</tr>';
    }

    if (
    $i != 0) echo '</tr>';
    echo
    "</table></div>";
    echo 
    "<br />";


  • #3
    New Coder
    Join Date
    May 2006
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Sweet tyvm.. Works like a charm..
    I was trying
    Code:
    $c=@mysql_data_seek($catquery,0);
    
    if($c) {
     echo "<div class='tableborder'><table><tr>";
    while ($c = mysql_fetch_array($catquery)) {
    
    if($c<5)
    echo  "<td width='5%' align='center' class='arcade1'><a href='Arcade.php?cat=$c[0]'>$c[1]</a></td>";
    }else{
    echo  "<tr align='center' class='arcade1'><a href='Arcade.php?cat=$c[0]'>$c[1]</a></tr>";
    }
    echo"</tr></table></div>";
    echo "<br />";
    }
    But it kept messing the tables up :|

    Thanks again
    BoN


  •  

    Posting Permissions

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