0
I am maintaining on a PHP system with Mysql. I noticed that in the user table there is a field called code. This field stores as follows:
id_usuario | codigo_usuario
1 00001
And the last value:
id_usuario | codigo_usuario
7810 07810
How could I calculate, can it be in PHP or within the table itself so that the next records keep this pattern? Ex:
id_usuario | codigo_usuario
7811 07811
Basically making a
LPAD
in id with length 5, but when it reaches 99999, which will happen after?– Woss
It is.... the type of this field is int(5).
– user24136
changed to int(11).
– user24136
If he is
int
, there will be no such zeros on the left, so it will be the same value as id.– Woss
Right. He’s that way:
codigo_usuario int(5) UN zerofill
. It seems that the colleague attributed this value.– user24136