Hi guys,
I'm having this problem which I'm sure is fairly basic. Heres the code:
$valueArray = array();
for($i=0; $i<11; $i++){
$getValue = mysql_query("SELECT value FROM players WHERE id =" . $teamArray[$i]);
$valueRow = mysql_fetch_array($getValue);
$valueArray[$i] = $valueRow['value'];
}
$total = $valueArray[0] + $valueArray[1] + $valueArray[2] + $valueArray[3] + $valueArray[4] + $valueArray[5] + $valueArray[6] + $valueArray[7] + $valueArray[8] + $valueArray[9] + $valueArray[10];
if($total > 50){
$message = "<div class='error'><strong>Oops!</strong><br />Make sure your team's value doesn't exceed 50 million.</div>";
return $message;
}
Everything works fine unless the total is exactly 50 then the Oops! message appears which surely it shouldn't do as I have set it to be if total is greater than 50???
The values are all set to 1 decimal place eg. 2.4, 3.9 etc which I think may be the problem but I'm not sure?
Your help much appreciated.