PDA

View Full Version : Stupid Function Question :)


Brian
02-20-2002, 02:39 AM
I am trying to use a function *I havent done this before*

$discount = lookup_points($points);
function lookup_points($points) {
if ($points >= 0 && $points <= 5) { return .75 }
if ($points >= 6 && $points <= 11) { return .70 }
if ($points >= 12 && $points <= 17) { return .65 }
if ($points >= 18 && $points <= 23) { return .60 }
if ($points >= 24 && $points <= 29) { return .55 }
if ($points >= 30 && $points <= 30) { return .50 }
}

I get an error with this.

What I am trying to do is output a discount depending on what range the points are in. So for instance if they had 9 points they would get .70 so the variable for $discount should show that if that was the number used.

What am I doing wrong? My error log states parse error on first if line.

Anyhelp is appreciated I wanna get this project done asap lol..

-BRian

Mark Hensler
02-20-2002, 03:52 AM
Semicolons

$discount = lookup_points($points);

function lookup_points($points) {
if ($points >= 0 && $points <= 5) { return .75; }
if ($points >= 6 && $points <= 11) { return .70; }
if ($points >= 12 && $points <= 17) { return .65; }
if ($points >= 18 && $points <= 23) { return .60; }
if ($points >= 24 && $points <= 29) { return .55; }
if ($points >= 30 && $points <= 30) { return .50; }
}

echo $discount;