close ad
Databridge V2 with MySQLi support IS Now Available!
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues


Currency Decimal Formatting

Thread began 8/27/2009 11:52 am by Kevin373660 | Last modified 8/28/2009 2:33 pm by Kevin373660 | 28456 views | 4 replies |


Currency Decimal Formatting

WebAssist dynamic sample site BlueSkyMusic uses the DECIMAL(19,0) datatype setting in MySQL schema tables for all monetary values. I am using php and MySQL along with DataAssist to create the catalouge. I found that you have to mannually add the text portion "Only $" before the <?PHP> code for the dynamic value. DWCS3 does not support crating a custom data format when using PHP according to Adobe Help docs.

How do you format the value to control the decimal place to display as $0.00 in the catalogue? Is there a way to do this with CSS?

Sign in to reply to this post

tom92909Beta Tester

There are 2 steps for that.

First you need to prepare PHP for USD. You can do that at the top of your page anywhere.

<?php setlocale(LC_MONETARY'en_US'); ?>

Lastly, you'll want to format your display price as follows...

<?php echo money_format('%(#6n'$row_Recordset['Price']); ?>

I think that should provide you with the output you're looking for..

Sign in to reply to this post


Thank you Tom for your reply. So it requires php formating. I am on WinXP, and read up fast and found these notes on, which confirms the need to use the function that you recomened:

Note: The function money_format() is only defined if the system has strfmon capabilities. For example, Windows does not, so money_format() is undefined in Windows.
Note: The LC_MONETARY category of the locale settings, affects the behavior of this function. Use setlocale() to set to the appropriate default locale before using this function.

I tried the following:


<?php setlocale(LC_MONETARY, 'en_US'); ?>

<div class="WADAResultPrice">Only $<?php echo money_format('%(#6n', $row_WADAproducts["ProdPrice"]); ?></div>


ERROR on page when displayed in a browser. I must be missing something in defining the fuction. Please advise if you can see where I went wrong. P&T:

Only $PHP Fatal error: Call to undefined function money_format() in {my site directory}shopping\Catalogue_Results.php on line 517


Are you sure that using the setlocale() is a wise idea? Additional notes on below indicate to me that it may depend on the local cpu and that would not give a consistanct display of costs for users. It might also explain why I recieved the error message. I might be wrong. I am new to php.

Return Values
Returns the new current locale, or FALSE if the locale functionality is not implemented on your platform, the specified locale does not exist or the category name is invalid.

An invalid category name also causes a warning message. Category/locale names can be found in » RFC 1766 and » ISO 639. Different systems have different naming schemes for locales.
Note: The return value of setlocale() depends on the system that PHP is running. It returns exactly what the system setlocale function returns.

Sign in to reply to this post

Eric Mittman

In eCart there is a function that is used to display the currency values, it is:


It will format a value to display as money including the currency symbol and decimal places. How the currency is formatted with the function will depend on how you have these values setup in your cart object. Here is an example of what the price might look like on a page with this function:

<?php echo WA_eCart_DisplayMoney($eCart1, "25.89"); ?>

This will include the currency character and other formatting that is setup in the cart object.

Sign in to reply to this post


Thank you!

Thanks Eric. I guess I was jumping ahead. I just want to have the catalogue and user access code process in place ready to integrate with eCart.

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question





Ease of use


security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...