[PHP-DB] number_format problem

2003-11-05 Thread Dillon, John
I want to show a number from a database in the format x,xxx.00 in a textfield, then if it is changed by the user I want to post the value of the number to a decimal field. However, once you number_format the number it becomes a string, and numbers like 3,379.90 give a value of 3 when posted to

Re: [PHP-DB] number_format problem

2003-11-05 Thread jeffrey_n_Dyke
] o.ukcc: Subject: [PHP-DB] number_format problem

Re: [PHP-DB] number_format problem

2003-11-05 Thread Peter Beckman
On Wed, 5 Nov 2003, Dillon, John wrote: I want to show a number from a database in the format x,xxx.00 in a textfield, then if it is changed by the user I want to post the value of the number to a decimal field. However, once you number_format the number it becomes a string, and numbers like

RE: [PHP-DB] number_format problem

2003-11-05 Thread Aleks @ USA.net
Great answer... One question though, how would you convert it back to X,xxx.00 format?? Thanks Aleks -Original Message- From: Peter Beckman [mailto:[EMAIL PROTECTED] Sent: Wednesday, November 05, 2003 10:48 AM To: [EMAIL PROTECTED] Subject: Re: [PHP-DB] number_format problem On Wed

RE: [PHP-DB] number_format problem

2003-11-05 Thread Peter Beckman
On Wed, 5 Nov 2003, Aleks @ USA.net wrote: Great answer... One question though, how would you convert it back to X,xxx.00 format?? number_format($variable,2); --- Peter Beckman

Re: [PHP-DB] number_format problem

2003-11-05 Thread CPT John W. Holmes
From: Dillon, John [EMAIL PROTECTED] I want to show a number from a database in the format x,xxx.00 in a textfield, then if it is changed by the user I want to post the value of the number to a decimal field. However, once you number_format the number it becomes a string, and numbers like

Re: [PHP-DB] number_format problem

2003-11-05 Thread CPT John W. Holmes
From: [EMAIL PROTECTED] could you cast as a float/double before inserting? $number = (double) $string; don't know what would happen to the comma, but i assume it would just get removed?? Everything after and including the first non-number character would be dropped. So $12,000.34 would end

Re: [PHP-DB] number_format problem

2003-11-05 Thread CPT John W. Holmes
From: Peter Beckman [EMAIL PROTECTED] On Wed, 5 Nov 2003, Dillon, John wrote: I use this: $x['funds'] = (int)preg_replace(/[\$,]/,,$x['funds']); where $x['funds'] contains something like $3,249,555.32, and the end result is an int of 3249555. I drop the cents... you want to keep

Re: [PHP-DB] number_format problem

2003-11-05 Thread jeffrey_n_Dyke
] rter.netSubject: Re: [PHP-DB] number_format problem 11

Re: [PHP-DB] number_format problem

2003-11-05 Thread CPT John W. Holmes
From: [EMAIL PROTECTED] sweet. thanks for hte correction. i try, sometimes i fail. :) But trying is half the battle. GI JOE! ---John Holmes... -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php