?
Solved

Format price/currency from MYSQL database using PHP

Posted on 2007-10-11
2
Medium Priority
?
3,668 Views
Last Modified: 2010-08-05
I have a row for PRICE in my database and it is formatted as an integer with no commas.  I am trying to figure out how to print the price in PHP with appropriate commas (ex 9,000 or 15,000).  Does anyone have any ideas?  Thanks!
0
Comment
Question by:jeveloff2
2 Comments
 
LVL 20

Accepted Solution

by:
steelseth12 earned 1000 total points
ID: 20059124
0
 
LVL 17

Assisted Solution

by:nplib
nplib earned 1000 total points
ID: 20059164
$number = 12345.67;  //number from DB
$formatedNumber = number_format($number, 2);
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

By, Vadim Tkachenko. In this article we’ll look at ClickHouse on its one year anniversary.
It’s a season to be thankful, and we’re thankful for users like you who engage on site, solve technology problems, and network with others in the industry. What tech are we most thankful for? Keep reading.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Suggested Courses

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question