SirChick Posted October 11, 2007 Share Posted October 11, 2007 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? Quote Link to comment Share on other sites More sharing options...
thedarkwinter Posted October 11, 2007 Share Posted October 11, 2007 code? you might be better of just making the db field a varchar anyway... unless you are planning on having the db do calculations rather than the php or whatever your front-end is written in Quote Link to comment Share on other sites More sharing options...
SirChick Posted October 11, 2007 Author Share Posted October 11, 2007 $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. Quote Link to comment Share on other sites More sharing options...
thedarkwinter Posted October 11, 2007 Share Posted October 11, 2007 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 Quote Link to comment Share on other sites More sharing options...
SirChick Posted October 11, 2007 Author Share Posted October 11, 2007 tried that and same thing occured Quote Link to comment Share on other sites More sharing options...
fenway Posted October 11, 2007 Share Posted October 11, 2007 you might be better of just making the db field a varchar anyway... No, never. Make it a DECIMAL with however many decimals you want. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.