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? Quote 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 } } Quote 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 Quote 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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.