PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old May 29th, 2000, 05:20 AM
iwarner iwarner is offline
BrainFreeze
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2000
Location: London
Posts: 318 iwarner User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 41 m 9 sec
Reputation Power: 13
Send a message via ICQ to iwarner Send a message via Yahoo to 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 >

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.

Reply With Quote
  #2  
Old May 29th, 2000, 11:31 AM
wouterr wouterr is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2000
Posts: 27 wouterr User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation 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

Reply With Quote
  #3  
Old May 29th, 2000, 11:36 AM
kcheng kcheng is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2000
Posts: 4 kcheng User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation 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>



Reply With Quote
  #4  
Old May 29th, 2000, 09:21 PM
jonherron jonherron is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2000
Posts: 24 jonherron User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation 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.

Reply With Quote
  #5  
Old May 29th, 2000, 09:47 PM
okhvatstas okhvatstas is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2000
Posts: 33 okhvatstas User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 14
Another solution to do alternating colors would be to check if $rownumber % 2 != 1, write one HTML color string, else write another.

Reply With Quote
  #6  
Old May 30th, 2000, 09:47 AM
iwarner iwarner is offline
BrainFreeze
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2000
Location: London
Posts: 318 iwarner User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 41 m 9 sec
Reputation Power: 13
Send a message via ICQ to iwarner Send a message via Yahoo to iwarner
Cheers guys - help is appreciated, I will crack on with that tonight.


Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPHP Development > Alternating Table Colours

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap