Hiding the decimal if .0 and showing zero if an interger
I have two, hopefully basic number questions.
First, I am using the decimal data type on MySQL to show data like speed
or height set to one decimal place like this decimal(4,1) My problem is
that for numbers with no dp it is still showing .0 - What I get is '309.0'
but what I want is '309'. What do I need to change to hide the '.0'?
Second I have an integer data type showing fixed numbers. Many of the
numbers are 0 zero but these are getting treated as null and not
displaying. How do I force the 0's to display? (I can't make table changes
for this because other columns do have zero's that are null values. It is
only this one column that needs zeros to display).
For both of these problems PHP is being used to display the results.
EDIT: code I'm using to display results. the top one needs to not show .0
the bottom one needs to show a zero.
Length:</b> %sft' . PHP_EOL, $row2['length'])
Inversions:</b> %s' . PHP_EOL, $row2['inversions'])
Thanks
No comments:
Post a Comment