close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Need number format on bindings

Thread began 7/18/2014 2:29 pm by Patrice | Last modified 7/19/2014 8:08 am by Patrice | 1001 views | 2 replies |

PatriceWebAssist

Need number format on bindings

I am working with an e-cart database. I am writing some custom code per client request.
I am writing a SUM on the OrderAmount and it is giving me the correct information, filtered by the coupon code (OrderTrackingNumber, per help from Ray today). However my report is showing many digits past the decimal point.

I have examined how it shows up in WA results page but can't find where in those page codes it is doing a limitation to 2 decimals.

31.84999942779541

should really be 31.84 ($31.85)

My query is

mysql_select_db($database_gator, $gator);
$query_july4 = "SELECT SUM(orders.OrderAmount) FROM orders WHERE OrderTrackingNumber LIKE '%JULY4%'";
$july4 = mysql_query($query_july4, $gator) or die(mysql_error());
$row_july4 = mysql_fetch_assoc($july4);
$totalRows_july4 = mysql_num_rows($july4);

and php is

<p><?php echo $row_july4['SUM(orders.OrderAmount)']; ?></p>


My research says I need to define number_format as in 12345, 2 but I am not sure where that comes into play. Top of page? How to write it? Or in the php echo?


Any help is most appreciated.

Sign in to reply to this post

Jason ByrnesWebAssist

use the number_format() function:
http://php.net/manual/en/function.number-format.php


<?php echo(number_format($row_july4['SUM(orders.OrderAmount)'], 2)); ?>

Sign in to reply to this post

PatriceWebAssist

Thanks so much!

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

Content

rating

Layout

rating

Ease of use

rating

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...