Jump to content

Recommended Posts

I have a problem with inputting a value to the database.... i made the sql input a variable which is lets 14.24243

 

But when this is added the Database inputs a full integer and skips the decimals... i tried the field type as Float and Decimal both created the same problem.. why is this?

Link to comment
https://forums.phpfreaks.com/topic/72786-field-type-problem/
Share on other sites

$DecimalRemovalStrength = 2.4244;
$addstrength = "UPDATE userregistration SET Strength=Strength+'$DecimalRemovalStrength' 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!');
				}

 

This is what i put to test and in my database it has : 2

 

I don't think its a mysql issue but staff moved the the thread here. I think its my apache but see what you make of it.. ill try var char anyway to see what happens.

 

Link to comment
https://forums.phpfreaks.com/topic/72786-field-type-problem/#findComment-367095
Share on other sites

Hi

 

try removing the ' ' around $DecimalRemovalStrength...

 

so

$DecimalRemovalStrength = 2.4244;
$addstrength = "UPDATE userregistration SET Strength=Strength+$DecimalRemovalStrength 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!');
				}

 

cheers,

tdw

Link to comment
https://forums.phpfreaks.com/topic/72786-field-type-problem/#findComment-367097
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.