This topic is locked

Get the string of Unsigned zerofill primary field

1/3/2016 4:10:59 PM
PHPRunner General questions
L
laonian author

My table's primary field ID is set int(8) unsigned zerofill.

When a record is inserted, it displays like 00000002. Now I

want to use its value to update another table. After record

is added. I tried to use $values['ID'] or $keys['ID'], but what

I got was last integer 2, not 00000002. Any ideas?
Thank you.

Sergey Kornilov admin 1/3/2016

An excerpt from http://stackoverflow.com/questions/5256469/what-is-the-benefit-of-zerofill-in-mysql

Using ZEROFILL and a display width has no effect on how the data is stored. It affects only how it is displayed.


In other words, if you want to use zero filled value in your events you need to pad it with zeroes manually.