Discover Habbo's history
Treat yourself with a Secret Santa gift.... of a random Wiki page for you to start exploring Habbo's history!
Happy holidays!
Celebrate with us at Habbox on the hotel, on our Forum and right here!
Join Habbox!
One of us! One of us! Click here to see the roles you could take as part of the Habbox community!


Results 1 to 6 of 6
  1. #1
    Join Date
    Feb 2008
    Location
    London, UK
    Posts
    15,747
    Tokens
    25,786
    Habbo
    Mr-Trainor

    Latest Awards:

    Default (Tables) Coding Help

    Hey,
    if you look at:
    http://www.clubpixels.co.uk/test
    you will see what's wrong. I have the correct amount of columns but now I need the items to automatically go accross and then start a new row for every 6 cells used. I've been told to use 'nested loops' but after searching that on Google, it doesn't seem to help me very much! All help is appreciated and the code at the moment is:

    HTML Code:
    <?php 
    include("config.php");
    include("opendb.php");
    $get_cats = mysql_query("SELECT * FROM `categories` ORDER BY `displayorder`") or die(mysql_error());
    $get_info = mysql_query("SELECT * FROM `systeminfo`") or die(mysql_error());
    $info = mysql_fetch_array($get_info);
    while($cats = mysql_fetch_array($get_cats)) {
    $get_rares = mysql_query("SELECT * FROM `rares` WHERE `catid`='".$cats['id']."'") or die(mysql_error());
    echo("<h2>".$cats['name']."</h2><br>
    
    <center>
    <table width=\"90%\" border=\"0\">
    ");
    $color1 = $info[stripe1]; 
    $color2 = $info[stripe2];
    $row_count = 0;
    while($rare = mysql_fetch_array($get_rares)) {
    $row_color = ($row_count % 2) ? $color1 : $color2;
    ?>
    <tr>
    
    <td width="15%" style="text-align:center;background-color:#<?php echo $row_color; ?>"><img alt="" src="<?php echo("".$info[imagepath]."".$rare['image'].""); ?>"  onmouseover="Tip('<b><?php echo $rare['name']; ?></b>.<br><i>Last Updated: <?php echo $rare['lastedited']; ?></i>')" onmouseout="UnTip()"><br><?php echo $rare['value']; ?> CS</td>
    
    <td width="15%" style="text-align:center;background-color:#<?php echo $row_color; ?>"></td>
    
    <td width="15%" style="text-align:center;background-color:#<?php echo $row_color; ?>"></td>
    
    <td width="15%" style="text-align:center;background-color:#<?php echo $row_color; ?>"></td>
    
    <td width="15%" style="text-align:center;background-color:#<?php echo $row_color; ?>"></td>
    
    <td width="15%" style="text-align:center;background-color:#<?php echo $row_color; ?>"></td>
    
    </tr>
    <?php 
    $row_count++;
    }
    echo("</table>
    </center><br>
    
    ");
    }
    ?>
    All help is greatly appreciated and will give +rep to any helpful information

    Not online very often

  2. #2
    Join Date
    Jan 2007
    Location
    London
    Posts
    38
    Tokens
    0

    Default

    The answer lies in CSS

  3. #3
    Join Date
    Jul 2008
    Posts
    179
    Tokens
    0

    Default

    use css


  4. #4
    Join Date
    Feb 2008
    Location
    London, UK
    Posts
    15,747
    Tokens
    25,786
    Habbo
    Mr-Trainor

    Latest Awards:

    Default

    Thanks for the help, +rep.
    I've never made my own CSS document though, any help?
    Last edited by Mr-Trainor; 09-12-2009 at 07:36 PM.

    Not online very often

  5. #5
    Join Date
    Feb 2008
    Location
    London, UK
    Posts
    15,747
    Tokens
    25,786
    Habbo
    Mr-Trainor

    Latest Awards:

    Default

    Quote Originally Posted by Mr-Trainor View Post
    Thanks for the help, +rep.
    I've never made my own CSS document though, any help?
    Rephrase that. I HAVE made many css documents in the past, althought not multiple column ones. Once I make it css though, how do I get the rares to show up in each box instead of being like a list and showing 1 per row?

    Not online very often

  6. #6
    Join Date
    Feb 2008
    Location
    London, UK
    Posts
    15,747
    Tokens
    25,786
    Habbo
    Mr-Trainor

    Latest Awards:

    Default

    All is now sorted!
    http://clubpixels.co.uk/mr-trainor/T...raresTEST2.php
    Thanks to all who helped

    Not online very often

Posting Permissions

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