Re: [PHP] Removing commas from number

2007-05-07 Thread Richard Lynch
On Sun, May 6, 2007 10:33 am, Todd Cary wrote: > Thanks to the suggestions, I use number_format($my_number, 2) to > format the > number in an edit field. Now I need to reenter it into MySQL. How > should I use > preg_replace to remove the commas? > > This removes the commas *and* the decimal po

Re: [PHP] Removing commas from number

2007-05-06 Thread Paul Novitski
At 5/6/2007 09:39 AM, Todd Cary wrote: You make a good point. What is your suggestion for the following sequence: $number = $row->AMOUNT; // Get the double from MySQL To display the number in the HTML edit field, I do $display_number = number_format($number, 2, '.', ''); The user may enter a

Re: [PHP] Removing commas from number

2007-05-06 Thread Todd Cary
Paul - You make a good point. What is your suggestion for the following sequence: $number = $row->AMOUNT; // Get the double from MySQL To display the number in the HTML edit field, I do $display_number = number_format($number, 2, '.', ''); The user may enter a character that will not be acce

Re: [PHP] Removing commas from number

2007-05-06 Thread Paul Novitski
At 5/6/2007 08:33 AM, Todd Cary wrote: Thanks to the suggestions, I use number_format($my_number, 2) to format the number in an edit field. Now I need to reenter it into MySQL. How should I use preg_replace to remove the commas? This removes the commas *and* the decimal point: preg_replace(

Re: [PHP] Removing commas from number

2007-05-06 Thread Tijnema !
On 5/6/07, Todd Cary <[EMAIL PROTECTED]> wrote: Thanks to the suggestions, I use number_format($my_number, 2) to format the number in an edit field. Now I need to reenter it into MySQL. How should I use preg_replace to remove the commas? This removes the commas *and* the decimal point: preg_r

[PHP] Removing commas from number

2007-05-06 Thread Todd Cary
Thanks to the suggestions, I use number_format($my_number, 2) to format the number in an edit field. Now I need to reenter it into MySQL. How should I use preg_replace to remove the commas? This removes the commas *and* the decimal point: preg_replace('/\D/', '', $str) In reviewing patterns