Old 10-24-2004   #1 (permalink)
Red Dawn
 
BlodoPKNZ's Avatar
 
Join Date: May 2004
Location: Eastern Europe
Posts: 302

Couple php questions

I just cant seem to figure this one out. Im trying to get mysql results to show up in a table with alternating rows. My code:
PHP Code:
function rowbg() {
static 
$j=1;
if (
$j%!= 0.5) {
echo 
"display_row1";
$j++;
} else {
echo 
"display_row2";
$j++; }

then i do:
PHP Code:
<tr class="<?php rowbg(); ?>">
to make it alternating. However it just returns the first case. Now where is my error?
__________________

Last edited by BlodoPKNZ; 01-10-2005 at 01:31 PM..
BlodoPKNZ is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Old 10-24-2004   #2 (permalink)
Moderator
 
Join Date: Jul 2004
Location: Quebec City, Canada
Posts: 50

1 % 2 = 1
2 % 2 = 0
3 % 2 = 1
4 % 2 = 0
5 % 2 = 1
...
The Eagle is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Old 10-24-2004   #3 (permalink)
Red Dawn
 
BlodoPKNZ's Avatar
 
Join Date: May 2004
Location: Eastern Europe
Posts: 302

....I was absolutely positive it was 0.5. Thanks man it works great now
__________________
BlodoPKNZ is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Closed Thread

Thread Tools
Display Modes

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT +1. The time now is 04:20 PM.
Content Relevant URLs by vBSEO 3.2.0

Design & Content © BioRUST 2008 :: PRIVACY STATEMENT :: LEGAL INFORMATION :: ADVERTISING MEDIA KIT