phpretard Posted November 10, 2009 Share Posted November 10, 2009 Inside of a while loop I need to echo several rows of info...easy enough. In the loop (for the sake off css) I need to distinguish between odd and even row numbers. <? connect(); $documentQ=mysql_query("select * from docs"); while($doc=mysql_fetch_assoc($documentQ)) { echo" <li class=\"oddrow\"><a href="docs/notes/PrincipalsNotes_0911.doc\">November</a></li> <li><a href=\"docs/notes/PrincipalsNotes_0910.doc\">October</a></li> <li class=\"oddrow\"><a href=\"docs/notes/PrincipalsNotes_0909.doc\">September</a></li> "; } free($documentQ); ?> Male sence? Any thoughts? Link to comment https://forums.phpfreaks.com/topic/180957-solved-odd-or-even/ Share on other sites More sharing options...
Adam Posted November 10, 2009 Share Posted November 10, 2009 if ($num % 2) { echo 'odd!'; } else { echo 'even!'; } Link to comment https://forums.phpfreaks.com/topic/180957-solved-odd-or-even/#findComment-954738 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.