Im making a rentals script but when they rent an object for more then 5 days something goes wrong.
this is how it should work:
when someone rents an object for 1 till 5 days they should pay that amount of days, but when they rent for 6 or 7 days they just have to pay for 5 days, this works for every 7 days they rent a object.
so 10 days will be 8 days paying
this is the script i already have:
function bedrag($fietsnummers, $aantaldagen)
{
$fiets = explode(',', $fietsnummers);
foreach($fiets as $fiets1)
{
$sql2 = "SELECT * FROM `fietsen` WHERE `fietsnummer` LIKE '".$fiets1."' LIMIT 0, 30 ";
$nummer = mysql_query($sql2)or die(mysql_error());
while ($fietsinfo = mysql_fetch_array($nummer))
{
$nummer1 = $fietsinfo['huurprijs'];
$bonus = intval($aantaldagen / 7);
$aantaldagen -= 2 * $bonus;
if($aantaldagen == "0")
{
$aantaldagen = "1";
}
$bedrag = $nummer1 * $aantaldagen;
$amount += intval($bedrag);
}
}
return $amount;
}