MasterPiece

05-29-2004, 10:55 PM

Hi there ,

I have a problem that I donno how to write this in PHP.

First I have this Function that I wrote to calculate points from a given value out of a Table Field from MySql.

<?

//what score function

function what_scores($amount_what) // Send in how many what points in the function.

{

$points = $amount_what;

$what[1] = $points-1;

for($i=2;$i<=15;$i++)

{

$what[$i] = round($catres[$i-1] * 0.95,1);

}

return $what; // Returns an array with the scores, $what[1] - $what[10]

}

?>

Now the problem that I have is how do I do i write a form that get the value from a field out of a other table lets say value 100 and check in the form first what place it has so lets say ( for example ) player 1 is ranked 2 and the value is 100 so 100 -1 then 95% , (place 2=) 90% etc etc ? and if course write the outcome of this back into MySql field. So place 2 is 100 and -1 and 90% of the first calculation of -1 =99 and the -5% as showen in the function !.

I hope some is clear as it is quiete hard to explain :)

Or other option that I could use is to read the place lets say 2 of the field in sql and then do the calculation and show it as query based on the same function !.

Thx in Advance

MasterPiece

I have a problem that I donno how to write this in PHP.

First I have this Function that I wrote to calculate points from a given value out of a Table Field from MySql.

<?

//what score function

function what_scores($amount_what) // Send in how many what points in the function.

{

$points = $amount_what;

$what[1] = $points-1;

for($i=2;$i<=15;$i++)

{

$what[$i] = round($catres[$i-1] * 0.95,1);

}

return $what; // Returns an array with the scores, $what[1] - $what[10]

}

?>

Now the problem that I have is how do I do i write a form that get the value from a field out of a other table lets say value 100 and check in the form first what place it has so lets say ( for example ) player 1 is ranked 2 and the value is 100 so 100 -1 then 95% , (place 2=) 90% etc etc ? and if course write the outcome of this back into MySql field. So place 2 is 100 and -1 and 90% of the first calculation of -1 =99 and the -5% as showen in the function !.

I hope some is clear as it is quiete hard to explain :)

Or other option that I could use is to read the place lets say 2 of the field in sql and then do the calculation and show it as query based on the same function !.

Thx in Advance

MasterPiece