Hi 'MD',
PHP has the sprintf() function to format strings. There should be sth. similar in SQL, either formatting your numbers via SQL or creating a field with the properties you requested, but i wouldn't bother since the SQL syntax might be different for different DB's. I'd prepare my data in PHP and write it to the DB already formatted.
try this:
$a = 5;
$a = sprintf("%02d",$a); # will assign '05' to $a
i think the function will treat your other values the way you want it,
12 will be '12' and 100 will be '100'.
with the first argument you tell the function how you want your new $a to look.
0 - is the padding character
2 - is the number of digits you want
d - you are formatting a decimal
if you want to print out the formatted value directly, you can use printf, same syntax. (careful - it only prints and does not return a value!)
make sure to check the manual (http://php.net/sprintf) to
learn some more about this neat function. it has many other possibilities that just formatting decimals.
also there's another function called number_format(). i haven't used it yet.
kind regards,
phil!