PDA

View Full Version : checking if number is equal or odd, but gives and error [fixed] function was in loop


Vaupell
01-24-2010, 03:37 PM
trying to count, and change row colors depending on equeal or odd count.
but the counter just fails when run..


$count='0';
$getcharname=$vbulletin->db->query("SELECT some query......
while($row=$vbulletin->db->fetch_array($getcharname)

$count++;
function checkNum($count){
return ($count%2) ? 1 : 0;
}
if(checkNum($count) === 1) {
$color='silver';
} else {
$color='gray';
}

}


the error im getting is

Fatal error: Cannot redeclare checkNum() (previously declared in C:\xampp\xampp\htdocs\emod\ewow.php:82)

--------------- Added 1264354742 at 1264354742 ---------------

/doh facepalm. well ofcourse did i place the function inside the loop..

Nevermind,, solved.. just saw it when posting..
again im using notepad and dont have these fance color setups..

lol