Jump to content

[SOLVED] modulus (%)


soycharliente

Recommended Posts

Am I not seeing some spelling error or is there something fundamentally wrong with this code?

while ($r = mysql_fetch_array($result)) {
$id = $r["id"];
if ($id % 2) {
	echo "<tr>\n";
} else {
	echo "<tr class=\"colored\">\n";
}
}

 

Every case takes the else route. WHYYYYYYYYYYY? AHHHHHHHHHHHHHHHH/

Link to comment
https://forums.phpfreaks.com/topic/57667-solved-modulus/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.