Outputting mysql db fields as formated #s, Using multi-row'd db selections and multi-fields, format the outpu |
Outputting mysql db fields as formated #s, Using multi-row'd db selections and multi-fields, format the outpu |
WotCGM |
Nov 11 2012, 02:29 AM
Post
#1
|
Group: Members Posts: 1 Joined: 11-November 12 Member No.: 18,092 |
Hello All.
I have a db-table in mysql that has 18 fields in it. Of those, 2 are badly formated... ie not at all. They show up as 1234567890123 . The data type is bigint. When I do my select statement in php, I come up with 30 rows of data (proper), but in each case, the two "badly formated" fields also show up that way. I would like them to show up as: 1,234,567,890,123 for example. So, this is both a php and mysql question. Thanks in advance.. Larry |
Ephraim F. Moya |
Dec 17 2012, 08:29 AM
Post
#2
|
Advanced Member Group: Members Posts: 167 Joined: 2-September 07 From: New Mexico Member No.: 3,702 |
Hello All. I have a db-table in mysql that has 18 fields in it. Of those, 2 are badly formated... ie not at all. They show up as 1234567890123 . The data type is bigint. When I do my select statement in php, I come up with 30 rows of data (proper), but in each case, the two "badly formated" fields also show up that way. I would like them to show up as: 1,234,567,890,123 for example. So, this is both a php and mysql question. Thanks in advance.. Larry php has a command called 'number_format' which will format numbers like you want. http://php.net/manual/en/function.number-format.php you can't do it in mySQL unless you change the field type from bigint to string. |
Lo-Fi Version | Time is now: 19th April 2024 - 05:07 PM |