User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 425,770 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,317 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting

Calculating Query

Join Date: Jan 2008
Posts: 71
Reputation: amigura is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 7
amigura's Avatar
amigura amigura is offline Offline
Junior Poster in Training

Re: Calculating Query

  #2  
May 16th, 2008
<?php

$age = 21;

if ($age >61) 

{

 $age_score = '0.5';

} 

elseif (($age >= 51) && ($age <= 60)) 

{

 $age_score = '1.0';

} 

elseif ($age <= 21) 

{

 $age_score = '2.5';

} 

elseif (($age >= 31) && ($age <= 50)) 


{

 $age_score = '1.5';

}  

elseif ($age >= 60) 

{

 $age_score = '1.5';

}  

elseif (($age >= 22) && ($age <= 30)) 

{

 $age_score = '2.0';

} 

?>

<BR>

<?php
 
$mc = 0;

if ($mc == 0) 

{

 $crash_score = '0.5';

} 

elseif (($mc >= 1) && ($mc <= 2)) 

{

 $crash_score = '1.0';

} 

elseif ($mc >2) 

{

 $crash_score = '1.5';

} 

$total=$age_score + $crash_score;
echo "age score $age_score <br>";
echo "crash score $crash_score <br>";
echo "total score ".$total;

?>
Reply With Quote  
All times are GMT -4. The time now is 2:42 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC