Programming Tools
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingProgramming Tools

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
SlickEdit: Code in over 40 languages across 7 platforms. SlickEdit’s unmatched power, speed, and flexibility allows even the most accomplished developers to write better code faster. Download a free trial today!
  #1  
Old April 1st, 2003, 07:18 PM
benos benos is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Feb 2003
Posts: 233 benos User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Article Dicussion: Alternating Row Colors With MySQL Results

If you have any questions or comments about this article please post them here.

This forum post relates to this article

Reply With Quote
  #2  
Old April 3rd, 2003, 12:39 PM
Sork Sork is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2003
Posts: 8 Sork User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
PHP Code:
<?php

function loopRows($row1 ''$row2 '')
{
    static 
$i 0;
    if (
$row1 == '' AND $row2 == '')
    {
        
$row1 'style="background-color:#EAEAEA"';
        
$row2 'style="background-color:#CCCCCC"';
    }
    return (
== $i++ % 2) ? $row1 $row2;
}

?>

<tr <?php echo loopRows() ?>>
       <td></td>
</tr>

Last edited by Sork : April 3rd, 2003 at 01:25 PM.

Reply With Quote
  #3  
Old April 3rd, 2003, 01:53 PM
HarryF HarryF is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2002
Posts: 17 HarryF User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
PHP Code:
 $alt ''// Initialize if you have error NOTICEs on

while ( $row $db->getRow() ) {

    
$rowColor == 'white' $rowColor 'black' $rowColor 'white';

    
// display row here



Reply With Quote
  #4  
Old April 3rd, 2003, 03:28 PM
jpenn jpenn is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2002
Location: Washington, DC
Posts: 317 jpenn User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 m 3 sec
Reputation Power: 6
Sork - modulas is slow, very slow. How come no one studies and uses the fast and efficeint bitwise operators? They are there for use ->
PHP Code:
/******************
Start ****er
******************/
$i = ( int )0;
/******************
Loop Records
******************/
while( $row mysql_fetch_object$query ) )
{
      
$color = ( $i ) ? 'white' 'black';
      
/**********************
      Display the stuff
      **********************/
      
$i++;


As efficeint as it gets...
__________________
~ Joe Penn

We work for free to help make this a valuable resource on the internet. Do you appreciate the help - did we provide help that will help you prosper and help that has contributed to sharpening your current skill set?

Show your appreciation and purchase something from our Amazon Wishlist's - it's simple and a great way to say thank you.




Reply With Quote
  #5  
Old April 3rd, 2003, 04:50 PM
Sork Sork is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2003
Posts: 8 Sork User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Thumbs up

thanks

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingProgramming Tools > Article Dicussion: Alternating Row Colors With MySQL Results


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 | 
  
 

Iron Speed




© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway