| | |||||
| ||||||||
| Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics. |
![]() |
| | LinkBack | Thread Tools |
| | THREAD STARTER #1 (permalink) |
| Senior Member Join Date: May 2005 Location: I'm right here
Posts: 3,525
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | Money values in MySQL Hello, What's the best method to store money values in a mysql? Float, double..or what? varchar doesn't work because I'll need to sort values by order some times. How can you store the value as the following format: x,xxx.xx not just xxx.xx Thank you, -Ahmed
__________________ WP Theme Developer Your One-stop for Premium Magazine/CMS WordPress Themes Deluxe Themes |
| |
| | THREAD STARTER #3 (permalink) |
| Senior Member Join Date: May 2005 Location: I'm right here
Posts: 3,525
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | Ah, so its possible to convert x,xxx.00 to xxxx.00 and xxxx.00 to x,xxx.00? What function can do this? I'm using php.
__________________ WP Theme Developer Your One-stop for Premium Magazine/CMS WordPress Themes Deluxe Themes |
| |
| | THREAD STARTER #5 (permalink) | ||||
| Senior Member Join Date: May 2005 Location: I'm right here
Posts: 3,525
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | Well, this function does it..but I don't want to change the values since I'm dealing with money, like they convert 1234.56; to 1,235. I would rather want it to be 1,234.56 just the same but with formatting of thousands. Edit: I figured something It worked for me, but I'm not sure if its 100% accurate ![]()
It seems to be working fine so if your values are stored in mysql as float type numbers just extract the value and format it using that function, it should look fine with thousands, this is useful for online stores/IPN. ![]() thanks for everyone assistance. Now, that we created the number format; we can still convert it to a regular float to use it in database or something; echo str_replace(',', '', $do_format); like this, I tried it and it worked. Thanks axilant for the key, that function was what I was looking for. Good luck everyone
__________________ WP Theme Developer Your One-stop for Premium Magazine/CMS WordPress Themes Deluxe Themes | ||||
| |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Tutorial: How to Install Apache2 MySQL and PHP on Windows | deadserious | Webmaster Tutorials | 35 | 09-21-2005 09:46 PM |
| HUGE Reseller Plans! Limited Quanity Left. Only $12.95 a month. 30 Day Money Back! | inogenius | For Sale / Advertising Board | 0 | 11-28-2004 05:50 PM |
| Modern Day "Who's On First" (but in Computerese) | suthra | The Break Room | 2 | 06-25-2004 07:02 AM |