php mysql数字格式输入价值



我使用数字作为我的货币输入值,因此当我输入

的数字时
15000 then it should be 15,000
55350 became 55,350

但是,当我保存该输入时,为什么在数据库中存储为

15.00 and 55.00

im使用decimal(18,2)进行此货币价值

这是我在输入类上的代码

    $(document).ready(function () {
      $(".mny").number(true); 
     }

我错过了什么,还是应该转换价值?

您尝试这样的尝试,

$(document).ready(function () {
    var withComma = $('#value').val().replace(/B(?=(d{3})+(?!d))/g, ",");
    var replaceDot = withComma.replace(/,/g, ".");
    console.log(withComma , replaceDot);
});

最新更新