son.of.the.morning Posted December 2, 2011 Share Posted December 2, 2011 Is this possible? i want to create a two colored table of records. And one got any idea's? Link to comment https://forums.phpfreaks.com/topic/252317-while-loop-with-alternative-styles/ Share on other sites More sharing options...
ManiacDan Posted December 2, 2011 Share Posted December 2, 2011 $rowNum = 0; while ( $row = fetch() ) { if ( ++$rowNum % 2 == 1 ) { //style = white } else { //style = grey } } Link to comment https://forums.phpfreaks.com/topic/252317-while-loop-with-alternative-styles/#findComment-1293509 Share on other sites More sharing options...
premiso Posted December 2, 2011 Share Posted December 2, 2011 The operator ManiacDan used ( % ) is called the modulus operator, incase you want to read up on it to understand what it does Link to comment https://forums.phpfreaks.com/topic/252317-while-loop-with-alternative-styles/#findComment-1293515 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.