'; echo '
Kalkulaator
'; $ifdogquery = mysql_query('SELECT * FROM wp_dog_base WHERE owners_id="'.$current_user->ID.'"'); $ifhasdogs = mysql_num_rows($ifdogquery); if($ifhasdogs!=0){ $query = mysql_query('SELECT wfs.quantity, wfs.last_check, wdb.dog_weight, wdb.dog_name, wdb.dog_pregnant, wdb.dog_age, wdbr.breed FROM wp_dog_base AS wdb INNER JOIN wp_dog_breed AS wdbr ON wdb.dog_breed=wdbr.id INNER JOIN wp_food_storage AS wfs ON wdb.owners_id=wfs.owner_id WHERE owners_id='.$current_user->ID.'') or die(mysql_error()); echo 'Hinnanguline toiduvajadus teie koertel ühes kuus
'; while($row = mysql_fetch_array($query)){ $birthdate = $row['dog_age']; $agestamp = time()-$birthdate; $age = ceil($agestamp/60/60/24/365); $weight=$row['dog_weight']; if($weight<=3){$foodstorage=33;$needsinahour=33/24;} elseif($weight<=5){$foodstorage=56;$needsinahour=56/24;} elseif($weight<=10){$foodstorage=120;$needsinahour=120/24;} elseif($weight<=15){$foodstorage=195;$needsinahour=195/24;} elseif($weight<=20){$foodstorage=270;$needsinahour=270/24;} elseif($weight<=25){$foodstorage=337;$needsinahour=337/24;} elseif($weight<=30){$foodstorage=405;$needsinahour=405/24;} elseif($weight<=35){$foodstorage=472;$needsinahour=472/24;} elseif($weight<=45){$foodstorage=562;$needsinahour=562/24;} elseif($weight<=55){$foodstorage=632;$needsinahour=632/24;} elseif($weight<=65){$foodstorage=647;$needsinahour=647/24;} elseif($weight<=75){$foodstorage=862;$needsinahour=862/24;} elseif($weight<=85){$foodstorage=955;$needsinahour=995/24;} elseif($weight<=95){$foodstorage=1050;$needsinahour=1050/24;} $needsinahourtotal=$needsinahourtotal+$needsinahour; //echo $row['dog_name'].' vajab tunnis '.$needsinahourtotal; if($age<2){ if($row['dog_pregnant']==1){ $puppy .= $row['dog_name'].', '.$row['breed'].' '.$age.'a (tiine) - (~'.number_format((($needsinahour*24*30)/1000), 1, ',', ' ').' kg)'; } else { $puppy .= $row['dog_name'].', '.$row['breed'].' '.$age.'a - (~'.number_format((($needsinahour*24*30)/1000), 1, ',', ' ').' kg)
'; } } else { if($row['dog_pregnant']==1){ $adult .= $row['dog_name'].', '.$row['breed'].' '.$age.'a (tiine) - (~'.number_format((($needsinahour*24*30)/1000), 1, ',', ' ').' kg)
'; } else { $adult .= $row['dog_name'].', '.$row['breed'].' '.$age.'a - (~'.number_format((($needsinahour*24*30)/1000), 1, ',', ' ').' kg)
'; } } } ?>
'.$puppy; } ?>
'.$adult; } ?>
Kalkulaatori nägemiseks peate koeri lisama, tehke seda SIIN!'; } } else { if($_POST['calculate-storage']){ $validate=1; $dogname=$_POST['dog-name']; $dogweight=$_POST['dog-weight']; $dogage=$_POST['dog-age']; if($dogname==''){$echo .= '