ok. everything looks right. but isnt working right :s
Code: Select all
$looseexp = rand(1,$cexp);
$lostexp = $pexp - $looseexp;
if($lostexp < 0){
$lostexp = $pexp;
}
$result = "You managed to get away successfully. But you lost " . $looseexp . " experience.";
mysql_query("UPDATE stardrome_playerinfo SET occupy_id='0', experience='$lostexp' WHERE id='$id'");
but it doesnt :s
it equals 0 for some reason. can anyone see where i might have ballsed up? i have tried making it 'if($lostexp > $pexp){.....
but that doesnt do the trick either. i have tried wrapping 0 in quotes, still no joy.
it works fine if $lostexp is lower than $pexp... but not other way round
any one see anything i have misseD?