28, May 2012

issue with number_format function - webmaster forum

 
Webdigity webmaster forums
[ Home | Help | Search | Forum's Shop | Archive | Login | Register | Webmaster Directory ]
Webdigity Webmaster Forums  >  Web Development  >  PhP
Topic: issue with number_format function
« previous next »
Pages: [1] Print
Instabuck - The easy way to sell digital products online

Author Topic: issue with number_format function  (Read 1512 times)
Sandwich Artist
*
Posts: 25
186 credits
Members referred : 0


« on: Jun 19, 2008, 07:46:17 pm »

Basically when I have a number that is an even thousand such as 1000 or 5000, they get displayed using the number_format as 1,000.00 or 5,000.00 for presentation, the problem is that when the user saves the values end up getting saved as 1 and 5 respectively.  I know that its something wrong with the number_format function itself, but now sure how to get around this and still be able to display the values with the proper formatting.  Any ideas?  Thanks in advance for any help.
Global Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6691
34714 credits
Members referred : 374


It's time to use PHP5!


« Reply #1 on: Jun 20, 2008, 07:57:46 am »

you need to convert the number back to 1000.00 or 1000 before you store the value in your database. use number_format only for presentation

Sandwich Artist
*
Posts: 25
186 credits
Members referred : 0


« Reply #2 on: Jun 25, 2008, 09:43:16 pm »

the problem is that there are nearly 100 values on the page and I never know which ones may get entered as an even 1000 so I'm not sure how to check and see if the value needs to be multiplied by 1000 before saving.
Global Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6691
34714 credits
Members referred : 374


It's time to use PHP5!


« Reply #3 on: Jun 25, 2008, 10:26:58 pm »

You need some fuinction to check the size of the number, check the php manual I'm sure I saw some there

Trackback URI for this entry : http://www.webdigity.com/trackback.php?topic=7792
Tags : number_format php Bookmark this thread : Digg Del.icio.us Dzone more....

Pages: [1] Print 
Webdigity Webmaster Forums  >  Web Development  >  PhP
Topic: issue with number_format function
« previous next »
Jump to:
User Area
Welcome, Guest. Please login or register.
Did you miss your activation email?
May 28, 2012, 08:21:00 pm





Login with username, password and session length

Donate to our community, and get a permanent link back to your site!

Donate to our community, and get a permanent link back to your site!






Web Design Gallery · Whois Lookup · Pagerank · Tag Browsing · Lo-fi version · Syndication · Webmaster forum history · Advertise
Developed by HumanWorks © 2005 - 2012 Webdigity webmaster community · sublime directory
Webdigity Webmaster Forums | Powered by SMF 1.0.12. © 2001-2005, Lewis Media. All Rights Reserved.