使用基于MYSQL阵列的查询将浮点值VALUES更改为小数点

I'm having the trouble of assigning decimal points, when i want to display the price of my product in the table in one of my php pages. Using number_format solves the problem when i want to display in the normal version, but when i want to display in a numeric array type, i don't know how to make the queried value into decimal points.

Any ideas? the data is stored as a float value, and the column price from menurecords is displayed as; how to input a decimal value here?

    echo "<td align='center'><font color='#FFFFFF'>".$row[2]."</font></td>";
select
    format(field, 2) as formatted
from
    table

Please take note that Format() returns a string, and the result will be with two decimal places (in the above example) - i.e. 10 will be formatted as 10.00.

OR you can also use

You want to use the TRUNCATE command.

http://dev.mysql.com/doc/refman/5.0/en/mathematical-functions.html#function_truncate

TRUNCATE(0.166, 2) = 0.16

or

ROUND(0.166, 2) = 0.17

hope this will sure help you.