Jump to content

Script keeps going to die


SirChick

Recommended Posts

I have a script that what ever you input will determine the amount added to a field....but it keeps going to the die after the query for the number of rows affected.

 


// this does get the value from the form so all is good here
$StrengthInput = mysql_real_escape_string($_POST['strength']);


$Total = ($StrengthInput) * 5;

$EnergySubtract = $Total;


If ($Total > $CurrentEnergy) {
Die ('You do not have enough energy!');
}
Else{
	include("houseinclude.php");

	$HouseType = $houserow["HouseType"];


	If ($HouseType == 'Blanket')
{
	$percentage1 = 0.001;
}

$PercentageAddOn = array();
			$PercentageAddOn[] = 2;
			$PercentageAddOn[] = 5;
			$PercentageAddOn[] = 6;
			$PercentageAddOn[] = 1;
			$PercentageAddOn[] = 1;

		$PercentageKey = array_rand($PercentageAddOn);
		$PercentageAddOn = $PercentageResults[$PercentageKey];

$NewPercentageStrength = $StrengthInput*($PercentageAddOn + $percentage1);

}

If ($StrengthInput > 0){
//New strength seems to always = 0 no idea why

				$NewStrength = $Strength * (1 + $NewPercentageStrength/100);
$StatStrengthGain = $NewStrength - $Strength;
				$addstrength = "UPDATE userregistration SET Strength=$NewStrength WHERE UserID='{$_SESSION['Current_User']}'";

				$resultresult = mysql_query($addstrength) or die(mysql_error());				
			If (mysql_affected_rows() == 0)
				{
				die('Error ID 0001, contact admin on the Civilian forums immediatly about this error!');
				}

			}

 

 

the result i keep getting is die('Error ID 0001, contact admin on the Civilian forums immediatly about this error!');

 

cant work out why :(

Link to comment
Share on other sites

Still goes to die...

 

I believe ive narrowed it down to this line:

 

$NewStrength = ($StrengthInput) * (1 + $NewPercentageStrength/100);

 

cos when i echo $NewStrength it echos "0" so that would mean the query updates nothing and thus it dies...

 

Is my maths syntax correct... it must be =/

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.