Jump to content

Recommended Posts

I have a datatable with a varchar field know as "price". At this time I have 3 rows in it; they are as follows: $ 18,500 $19,500 and $ 9,500. The problem is that when I try to sort in either ascending or descending order; it does not sort right. I know the problem lies in the $ 9,500, because I added a zero in front of the 9,500 (like this: $ 09,500) and it sorted fine. At first I thought it may have had something to do with the dollar sign, but it didn't because I removed and tested it without dollar sign and still had the same problem. What I want to know is, how I can make datatable sort accurately with putting a zero in front of the 9,500. I tried to use a CSS style to cover up the zero, but when I did that, datatable still would not sort the right way. MySQL code in my web page is accurate, because you can take the $ 9,500 and add a 5 digit number and it works fine.

 

Anyone know what I need to do to fix this?

Link to comment
https://forums.phpfreaks.com/topic/44199-solved-problem-sorting-currency/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.