标签: php mysql mysqli development-environment
我想在Database(DDN00000001,DDN00000002,DDN00000003 and so on , as user ID)
Database(DDN00000001,DDN00000002,DDN00000003 and so on , as user ID)
如何在整数前连接字符串并存储在数据库中。
答案 0 :(得分:0)
如果要在PHP中将整数标识符转换为此表单,在将其发送到数据库之前,可以使用str_pad:
$user_id = 1; $padded_user_id = 'DDN' . str_pad ($user_id, 8, '0', STR_PAD_LEFT);