Hi there,
I am looking for help with the following :
I have cameras.
I have dvr's - 3 types - 4 channel, 8 channel, and 16 channel.
Someone on the web page enters the amount of cameras -
I need to work out how many dvr's (dependent on channels) they need
My code so far is pretty poor
if($qty % 4 >= 0){
$dvr = 4;
}
if ($qty > 4 && $qty < 9)
{
$dvr = 8;
}
if ($qty > 8 && $qty < 17)
{
$dvr = 16;
}
if ($qty > 16)
{
$mod = $qty % 4;
echo "mod = ". $mod."<br><br>";
}
echo "You need a ".$dvr. " port dvr";
Example - if $qty=19;
It should read "1 16 port dvr and 1 4 port dvr"
Example - if $qty=24;
It should read "1 16 port dvr and 1 8 port dvr"
Example - if $qty=30;
It should read "2 * 16 port dvr"
I tried mucking around with the mod function - and probably need some sort of recursion - but am a bit lost now.
Any help greatly appreciated
kindest Regards
ikenD