Having trouble storing dollar amounts in the thousands due to the "," that gets inserted once the number becomes 1, 000.00. Any advise?

Recommended Answers

All 2 Replies

Filter the "." before you insert it. You can replace the period by applying replace():

INSERT INTO mytable myvalue VALUES (replace('1.000','.',''));

I appreciate your advise. However this turned out to be a beginner's mistake. I was using number_format() "BEFORE" my insert statement. That was throwing the "," in there. I just took off the number_format(), and used decimal(10,2) and it works perfectly. Sorry. haha lesson learned :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.