/    Sign up×
Community /Pin to ProfileBookmark

Make sure the price looks like $110,000 and not $110000

I have to display like $110,000 and not like $110000. How to design the table field.If take price field as int then it will not take value 110,000 and if I take it as varchar then it will take as 110,000 but then how i will perform the mathematical function like 110,000*2 or 110,000+500.

to post a comment
PHP

3 Comments(s)

Copy linkTweet thisAlerts:
@NogDogAug 28.2012 — number_format()

(In other words, store it as an INT or possibly DECIMAL in the DB table, and let PHP handle the formatting when outputting it to the user.)
Copy linkTweet thisAlerts:
@George88Aug 28.2012 — Edit: redundant post.
Copy linkTweet thisAlerts:
@basudeoauthorAug 29.2012 — Thanks. I can't imagine i get answer so quickly.
×

Success!

Help @basudeo spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.27,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...