masterofollies

08-08-2008, 03:39 AM

Ok I hope this isn't too much extreme math to figure out. I will make it as easy to understand as possible.

Based on the number of members you have in your group, I want a set percent go to each member. Such as 50%, 10%, 3%, 1%.

So I set it up like this.

if ($row["members"] < "3")

{

$amount = "50%";

}

elseif (($row["members"] > "2") && $row["members"] < "11")

{

$amount = "10%";

}

elseif (($row["members"] > "10") && $row["members"] < "31")

{

$amount = "3%";

}

elseif ($row["members"] > "30")

{

$amount = "1%";

}

Nothing wrong right? So then I want to subtract the percent from the amount of experience the group has gained.

Such as if they have 100,000 experience and they only have 1 or 2 members, they should both get 50,000 (50% each).

I setup this string.

$add = $row["exper"] - $amount;

Didn't work, so I tried

$add = $row["exper"]/$amount;

And then it gave like 60207.27 which wouldn't exactly work, but I know you can do the round up or round down code for that. But anyways it's incredible the wrong number, 60,000 from over 3,000,000 experience at 50% each? Big error. Am I doing this all wrong?

Based on the number of members you have in your group, I want a set percent go to each member. Such as 50%, 10%, 3%, 1%.

So I set it up like this.

if ($row["members"] < "3")

{

$amount = "50%";

}

elseif (($row["members"] > "2") && $row["members"] < "11")

{

$amount = "10%";

}

elseif (($row["members"] > "10") && $row["members"] < "31")

{

$amount = "3%";

}

elseif ($row["members"] > "30")

{

$amount = "1%";

}

Nothing wrong right? So then I want to subtract the percent from the amount of experience the group has gained.

Such as if they have 100,000 experience and they only have 1 or 2 members, they should both get 50,000 (50% each).

I setup this string.

$add = $row["exper"] - $amount;

Didn't work, so I tried

$add = $row["exper"]/$amount;

And then it gave like 60207.27 which wouldn't exactly work, but I know you can do the round up or round down code for that. But anyways it's incredible the wrong number, 60,000 from over 3,000,000 experience at 50% each? Big error. Am I doing this all wrong?