#1
  1. No Profile Picture
    Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2000
    Posts
    5
    Rep Power
    0
    how to format output of database into money format,ex: tou got form for entering number,then you want to fetch the result into money format like;
    entry;20000000
    output:$20,000,000 etc
    the problem is entry using integer so every format function will fail.
    thanks in advance

    ------------------
    great hope of palembang ,indonesia
  2. #2
  3. Banned (not really)
    Devshed Supreme Being (6500+ posts)

    Join Date
    Dec 1999
    Location
    Brussels, Belgium
    Posts
    14,642
    Rep Power
    4476
    Read the manual.

    echo "$" . number_format($integer);

    ---John Holmes...

    number_format

    (PHP 3, PHP 4 )

    number_format -- Format a number with grouped thousands

    Description

    string number_format (float number, int decimals, string dec_point, string thousands_sep)

    Number_format() returns a formatted version of number. This function accepts either one, two or four parameters (not three):

    If only one parameter is given, Number will be formatted without decimals, but with a comma (",") between every group of thousands.

    If two parameters are given, number will be formatted with decimals decimals with a dot (".") in front, and a comma (",") between every
    group of thousands.

    If all four parameters are given, number will be formatted with decimals decimals, dec_point instead of a dot (".") before the decimals
    and thousands_sep instead of a comma (",") between every group of thousands.

Similar Threads

  1. Text box Number formatting
    By Bijoos in forum Visual Basic Programming
    Replies: 6
    Last Post: February 17th, 2004, 09:19 PM
  2. Formatting money values in mySQL
    By Hughes2003 in forum MySQL Help
    Replies: 0
    Last Post: February 6th, 2004, 06:46 AM
  3. Formatting Number
    By la2004 in forum Visual Basic Programming
    Replies: 3
    Last Post: January 13th, 2004, 08:32 AM
  4. formatting a phone number
    By aliaga61 in forum ASP Programming
    Replies: 1
    Last Post: December 31st, 2003, 03:21 AM
  5. Replies: 1
    Last Post: November 22nd, 2003, 03:02 PM

IMN logo majestic logo threadwatch logo seochat tools logo