www.webdeveloper.com
Results 1 to 4 of 4

Thread: Make sure the price looks like $110,000 and not $110000

  1. #1
    Join Date
    Aug 2012
    Posts
    5

    Arrow Make sure the price looks like $110,000 and not $110000

    I have to display like $110,000 and not like $110000. How to design the table field.If take price field as int then it will not take value 110,000 and if I take it as varchar then it will take as 110,000 but then how i will perform the mathematical function like 110,000*2 or 110,000+500.

  2. #2
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    19,432
    number_format()
    (In other words, store it as an INT or possibly DECIMAL in the DB table, and let PHP handle the formatting when outputting it to the user.)
    "Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
    ~ Terry Pratchett in Nation

    eBookworm.us

  3. #3
    Join Date
    Sep 2011
    Location
    Bristol, England, United Kingdom
    Posts
    192
    Edit: redundant post.

  4. #4
    Join Date
    Aug 2012
    Posts
    5
    Thanks. I can't imagine i get answer so quickly.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles