Well, I am guessing you set up your database incorrectly. I suspect you are using a string field to store the amount number. You should be using a NUMERIC filed for numbers not a string field. So, as-is, your string field is working as it should. To fix it, you could do several things, each are different and some can be tricky.
The best is to remember to store all numbers in a database as numeric, not strings. Then, when you display them, use the “number_format()” function to format them into a string for displaying.
Or, you could format the current string and add zeros to the “fake” numbers you are currently using.
So, $9,000,000, $9,999 and $123 would become $9,000.000, $000,009,999 and $000,000,123. This
is a little tricky, but, can be done in a correctly formulated format instruction…
Or, you could run your query and add an order-by option to sort by Len$($price-whatever) THEN order-by $price… (Or was that the other way around…?) So, it would sort by size of “fake” number, $123 would be before $9,999 due to length of the STRING, then sorted by actual values of the STRINGS.
Not sure if all this is making it harder for you to understand or clearing it all up. Basically, you are playing with a string, not a number. In my opinion, the database was not set up correctly for use of this number.
It always makes easier use of and faster database operations if using number fields for numbers.
Hope this helps… Good luck, which ever way you choose, we are here to help…