<分区>
在 mysql 中更新列中的数字为 9 位
例如:
658 were recorded, but must be 000000658,
if 96258, this must be 000096258, front contributed to 0.
谢谢
标签 mysql
<分区>
在 mysql 中更新列中的数字为 9 位
例如:
658 were recorded, but must be 000000658,
if 96258, this must be 000096258, front contributed to 0.
谢谢
最佳答案
我认为您必须将数据类型从 int 更改为 varchar(9)。在提交到数据库之前,只需将代码添加到零即可。
PHP 示例:
$foo = "604";
while(strlen($foo) < 9)
{
$foo = "0".$foo;
}
$foo 现在等于 000000604。您需要做的就是编写一个循环以从您的数据库中提取并提交回它。
关于MYSQL 列更新,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20116435/