comparison problem
| From: | Bart Verbeek | Date: | Wed, 10 Oct 2001 13:18:57 +0000 |
| Subject: | comparison problem | ||
| Groups: | php.db php.general | ||
| Request: | Send a blank email to php-db+get-13191@lists.php.net to get a copy of this message | ||
Hello people,
I seem to have a problem with comparing a few values.
I'm queriing the db for $row_uren[uren] and $row_uren[uren_verbruikt]
$uren_tegoed = the difference between [uren] and [uren_verbruikt] from the
db.
Than I split up $uren_tegoed in $uren_int (whole numbers) and $uren_dec
(decimals).
I want to check if the decimals and if they are
- between 01 and 25 it has to be set to 25
- between 26 and 50 it has to be set to 50
- between 51 and 75 it has to be set to 75
- between 76 and 99 or is 00 it has to be set to 00
<?PHPCODE
#AANTAL UREN SPLITTEN (INT/DEC) EN KLOKJES WEERGEVEN
$uren_tegoed = $row_uren["uren"] - $row_uren["uren_verbruikt"];
list ($klok_int, $klok_dec) = split('.', $uren_tegoed);
if ($klok_dec >= "01" AND $klok_dec <= "25") {
$klok_dec = "25";
$klok_dec_image = "klok_4-1.gif";
} elseif ($klok_dec >= "26" AND $klok_dec <= "50") {
$klok_dec ="50";
$klok_dec_image = "klok_4-2.gif";
} elseif ($klok_dec >= "51" AND $klok_dec <= "75") {
$klok_dec ="75";
$klok_dec_image = "klok_4-3.gif";
} elseif ($klok_dec >= "76" AND $klok_dec <= "99" || $klok_dec ==
"0" ||
!isset($klok_dec)) {
$klok_dec ="0";
$klok_dec_image = "klok_4-0.gif";
--$klok_int;
} else {
$klok_dec ="ERROR";
$klok_dec_image = "ERROR";
}
PHPCODE?>
I keep getting the ERROR at the bottom of the page.
Can anyone help me with this??
Thanks in advance..
Bart