Forum Moderators: coopster

Message Too Old, No Replies

Newbie College Student in Need of Help

custom function using if , elseif esle

         

yakstudent

3:30 am on Jul 7, 2005 (gmt 0)

10+ Year Member



I have beating my head against the wall for 6 days trying to figure out this function, and keep getting a parse error on line 8. Can anyone please take the time to help me? Here's the code.

function ship_cost($mer){
if ($mer <= 25) {
return 3;
} elseif ($mer >= 26 && <= 50) {
return 4;
} elseif ($mer >= 51 && <= 75) {
return 5;
} elseif ($mer > 75) {
return 6;
} else {
}
}
$ship = ship_cost($mer);

jatar_k

3:47 am on Jul 7, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Welcome to WebmasterWorld yakstudent,

does that mean you study yaks ;)

} elseif ($mer >= 26 && <= 50) {

you have a few problems, you need to restate the variable in those complex ifs, the above should be

} elseif ($mer >= 26 && $mer <= 50) {

you need to fix the same a couple times

yakstudent

5:50 am on Jul 7, 2005 (gmt 0)

10+ Year Member



Thanks for the help, so simple, yet so eluding.