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
https://forums.phpfreaks.com/topic/260643-update-is-driving-me-crazy/
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 :)

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.