1
我在我的mysql数据库中存储了一些货币值,我现在将字段类型设置为小数(10,2),这使我的价格为2.22英镑。我需要改变它,所以它的格式是1.3044英镑。每次我输入值1.3044将值1.30保存到数据库时,是否有人知道显示类似的正确类型? £1.3044更改mysql中的货币小数位
编辑>>>>
按照下面的答案,这现在工作,并保存在正确的格式的数据,问题是现在,由于某种原因,当它重新加载到表单字段后它将其更改为1.30,即使在数据库中它是1.3044。
<div class="oilprices" style="width:800px; height:auto; float:left;margin-left:15px;">
<div style="float:left; width:235px "><span class="ccms_form_element cfdiv_text" id="oilpricegasoil"><strong><span style="font-weight:bold;margin-top:4px; float:left;"><span style="font-size:15px; padding-right:10px;">Oil Prices - </span> Gas Oil</span> £</strong>
<input name="oilpricegasoil" style="padding:3px !important; background:#fff;" type="text" class="form-field" id="oilpricegasoil" title="oilpricegasoil" size="3" maxlength="10" label_over="0" hide_label="0" /><span style="padding-left:2px;">PPL</span>
</span></div>
<div style="float:left; width:130px; margin-left:5px; "><span class="ccms_form_element cfdiv_text" id="oilpricegasoil"><strong>Derv £</strong>
<input name="oilpricederv" type="text" style="background:#fff;padding:3px !important;" class="form-field" id="oilpricederv" title="oilpricederv" size="3" maxlength="10" label_over="0" hide_label="0" /><span style="padding-left:2px;">PPL</span>
</span></div>
<div style="float:left; width:135px; margin-left:5px; "><span class="ccms_form_element cfdiv_text" id="oilpricegasoil"><strong>Kero £</strong>
<input name="oilpricekero" style="background:#fff;padding:3px !important;" type="text" class="form-field" id="oilpricekero" title="oilpricekero" size="3" maxlength="10" label_over="0" hide_label="0" /><span style="padding-left:2px;">PPL</span>
</span></div>
<input name="cf_id" type="hidden" id="cf_id" value="">
<div style="width:40px; float:left;padding-left:10px">
<input type="submit" name="button" id="button" value="Update">
</div>
</div>
谢谢,这个工程现在,好样的,如果我在1.3044键入它保存到数据库中正确现在,如果我去到数据库中的数据是正确的保存为1.3044,但出于一些奇怪的原因,当它将数据加载回表单域时,它将其显示为1.30,即使在db中它是1.3044 – 2012-01-30 17:47:36
@IainSimpson我的问题是,你如何在HTML中加载这个值?你使用什么服务器端语言? – Ibu 2012-01-30 18:05:07