#1
  1. No Profile Picture
    BrainFreeze
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2000
    Location
    London
    Posts
    318
    Rep Power
    15
    I am producing a league table, that is ordered by points, I wish to smarten the table up by alternating the row colours, i am a newbie - and have looked everywhere for an easy solution, can anyone help me please >

    Also if my league had 10 age groups, would it be easier to have 10 pages with the php calling each table out, or is there some other ingenious way of knowing what the person wants to see.
  2. #2
  3. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2000
    Posts
    27
    Rep Power
    0
    This looks like a standard HTML solution

    <BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">code:</font><HR><pre>
    <TABLE>
    <TR>
    <TD BGCOLOR="#0000FF">Hello There</TD>
    </TR>
    </TABLE>
    [/code]
    gives you a perfect table column with a Blue background
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2000
    Posts
    4
    Rep Power
    0
    <BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">quote:</font><HR>Originally posted by iwarner:
    I am producing a league table, that is ordered by points, I wish to smarten the table up by alternating the row colours, i am a newbie - and have looked everywhere for an easy solution, can anyone help me please >
    [/quote]

    You can adapt the following code to create a table with alternating row colours:

    <table>
    <?
    $row = 0;
    $search = mysql_query("select some_columns from some_tables");
    while ($search_values = mysql_fetch_array($search)) {
    $row++;
    if (floor($row/2) == ($row/2)) {
    echo '<tr bgcolor="#ffffff">' . "n"; // in white
    } else {
    echo '<tr bgcolor="#f4f7fd">' . "n"; // in light blue
    }
    echo ' <td>$search_values["column1"]</td>
    echo '</tr>' . "n";
    }
    ?>
    </table>


  6. #4
  7. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2000
    Posts
    24
    Rep Power
    0
    Also if my league had 10 age groups, would it be easier to have 10 pages with the php calling each table out, or is there some other ingenious way of knowing what the person wants to see.

    if you have 10 pages then that is 10x the upkeep. I think i can speak for a lot of programmers when i say that i am lazy as hell. I would do it like this:
    http://mydomain.com/teams.php3?team=bears

    then in your php query the database for $team and display their results.
  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2000
    Posts
    33
    Rep Power
    15
    Another solution to do alternating colors would be to check if $rownumber % 2 != 1, write one HTML color string, else write another.
  10. #6
  11. No Profile Picture
    BrainFreeze
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2000
    Location
    London
    Posts
    318
    Rep Power
    15
    Cheers guys - help is appreciated, I will crack on with that tonight.

Similar Threads

  1. League table problem
    By silverduck in forum MySQL Help
    Replies: 8
    Last Post: February 10th, 2004, 12:38 PM
  2. Replies: 0
    Last Post: January 30th, 2004, 02:18 PM
  3. how to keep table on top, not centered??
    By vinyl in forum HTML Programming
    Replies: 2
    Last Post: January 20th, 2004, 06:19 PM
  4. Controlling Multiple table Heights in a Browser
    By AttaBoy in forum HTML Programming
    Replies: 1
    Last Post: December 10th, 2003, 04:24 AM
  5. Table structure for Dinner table design
    By PHP Addict in forum MySQL Help
    Replies: 1
    Last Post: November 27th, 2003, 07:50 AM

IMN logo majestic logo threadwatch logo seochat tools logo