Here is my problem, We are attempting to put prices into our database but for whatever reason it converts 10.00 to 10 OR 10.50 to 10.5 it keeps it simply chops from the trailing zeroes....
I checked the SQL statement also it states cost=10.00 .... so Im really confused whyOrexactly where it's draining the .00
Ive checking completely through where we go into the number towards the final step in the Place or UPDATE also it keeps the trailing zeroes all of the before the UPDATE or Place after which whenever you look into the table ...the zeroes are dropped
are you currently utilizing a
decimal(N,2) type, or similar, for storing the information? otherwise, than the is common behavior. see http://dev.mysql.com/doc/refman/5.0/en/numeric-types.html
please, don't stick to the advice in another answer and then leave this for your presentation layer. get the job done correctly and keep exact decimal value. this way you avoid rounding issues.
ps additionally, there are the separate problem of methods the worthiness is handled in whatever language you're using. hopefully it utilizes a special type which includes appropriate formatting. otherwise, then you might want to be worried about the way you handle the worthiness inside your code (one possibility would be to multiple by 100 and employ an integer quantity of cents, however you have to be mindful that maths models properly - this really is complicated, but it is complicated for any reason should you just stuff my way through doubles it'll be simple, but possess some strange bug for several values...)
10 is equivalent to 10.00 is equivalent to 10.
if you wish to display with individuals trailing numbers, or as it is more generally known 2 decimal places, then you will have to write your code to achieve that. Since you haven't stated what language you are using I can not really assist you with that part.
It does not matter the way it looks within the database. What matters is when you present data inside your application. 10.00 is identical value as 10, so within the data table it will likely be saved as 10.
You need to format number before output.