Jump to content


Photo

commas in numbers


  • This topic is locked This topic is locked
2 replies to this topic

#1 Tandem

Tandem
  • Members
  • PipPipPip
  • Advanced Member
  • 251 posts

Posted 16 July 2006 - 04:52 AM

Ok, i'm mysql_query()'ing and then mysql_result()'ing, so that i can print values from my database onto my site. One of these is an integer. I want there to be commas in the integer if possible. For example: instead of 1000000 - it would be 1,000,000.

Is this possible? if so how?

Thanks in advance.

-Tandem

#2 willfitch

willfitch
  • Members
  • PipPipPip
  • Advanced Member
  • 109 posts
  • LocationNew Hope, PA

Posted 16 July 2006 - 04:53 AM

There are a couple of ways to do this:

Using SQL
SELECT FORMAT(field_name)
or PHP:
number_format($int)
Zend Certified Engineer (ZEND001989)
www.willfitch.com

#3 Tandem

Tandem
  • Members
  • PipPipPip
  • Advanced Member
  • 251 posts

Posted 16 July 2006 - 04:54 AM

Awesome, I couldn't have asked for btter help!

Thankyou.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users