Jump to content

[SOLVED] Decimal numbers


Porl123

Recommended Posts

I have a variable that contains a random number

 

$rand = rand(0.1,0.3);

 

and I try to update my record in my database

 

UPDATE table SET field = field + $rand

 

the data type in for this row is decimal, but for some reason when it goes through, the number rounds itself. I've never really used decimals much before so it's might be obvious where I'm going wrong, but I don't want it to round off. Can anyone tell me what's wrong? Much thanks

Link to comment
https://forums.phpfreaks.com/topic/122145-solved-decimal-numbers/
Share on other sites

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.