Jump to content

update is driving me CRAZY


GRooVeZ

Recommended Posts

hi guys

 

when a match is over, two result fields have to be edited

 

the first update goes well

but the second one is failing, not allways, sometimes it gives the loser xp, but not the winner (with two players)

 

the script should give the winner 100 xp

second 95, third 90,...

 

only the first two controls at the end are working

the thirth one is not, and its being used to make the first two

so it is doing its job there ...

 

<?php

 

include("./includes/egl_inc.php");

$secure = new secure();

$secure->secureGlobals();

page_protect();

 

global $config;

 

$matchidcheck = $_SESSION['matchid'];

$maks = '100';

 

$players=mysql_query("SELECT playerid FROM ffa_points WHERE matchid='$matchidcheck' order by killsdeaths DESC");

while(list($playerid)=mysql_fetch_array($players))

{

 

$playerspoints=mysql_query("SELECT points FROM members WHERE id='$playerid'");

while(list($points)=mysql_fetch_row($playerspoints))

{

$userpoints = $points;

}

$newpoints = $userpoints + $maks;

mysql_query("UPDATE members SET points = $newpoints

WHERE id='$playerid'");

mysql_query("UPDATE ffa_points SET xppoints = $maks

WHERE id='$playerid' and matchid='$matchidcheck'");

if ($totalxp > 51)

{

$maks = $maks - 5;

}

 

}

 

            $mes="$newpoints $points $maks All Results have been stored succesfully !! Thank You !";

return success($mes,'./ffamatchesarchive.php');

 

include("$config");

?>

 

any help would be greatly appreciated

 

THX

Link to comment
Share on other sites

sorry my bad

 

i changed the var name and forgot to edit before posting

 

its not solving the problem :(

 

it has to be         

  if ($totalxp > 51)

            {

            $maks = $maks - 5;

            }

 

and yea, i am using while loops while i shouldnt ...

thx for showing me how :)

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.