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? Quote Link to comment 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!'; } Quote Link to comment 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.