Page 1 of 1

How to remove decimals in php (sql)?

Posted: Sun Feb 18, 2007 10:22 am
by Darla
Hello

I am wondering if there are any ways to remove extra decimals in php (or alternatively in sql)? I fetch aome average values from a table, and I wish to keep only one decimal or remove decimals entirely.
Ex:
14.6154 should be 14.6 og just 14.

Are there any "ready-to-use" functions for this in php/mysql?

Darla

Posted: Sun Feb 18, 2007 10:37 am
by feyd
uh, round() and uh.. ROUND()

Posted: Sun Feb 18, 2007 11:00 am
by Darla
Thanks, cant believe I did not find this when searhing php.net... I must be tired.
Well, it works perfectly now :)