PDA

View Full Version : unsigned zerofill and clean_array_gpc


Lionel
02-15-2007, 03:03 PM
I have a field in database set as INT (7) unsigned zerofill
The value in there is "0096071".

When I browse to ?mid=0096071&do=insert

and in the php do

$vbulletin->input->clean_array_gpc('r', array(
'mid' => TYPE_UINT
));
$myid = & $vbulletin->GPC['mid'];

$myid drops the zeros in front and becomes 96071

How can I make it read the zeros also?

Guest190829
02-15-2007, 04:12 PM
Try TYPE_UNUM instead of TYPE_UINT.

Lionel
02-15-2007, 04:31 PM
Thanks, but same results: missing zeros upfront. Temporary I removed the zero filled, but that is really no good for me.

Marco van Herwaarden
02-16-2007, 07:01 AM
Storing values with zerofill is not really good coding practise.

Zerofill is a display attribute, not something you want to store and use internally in your scripts.

Lionel
02-16-2007, 07:03 AM
problem is I am getting that value 0096071 from somewhere else, I am not creating it.

Marco van Herwaarden
02-16-2007, 07:16 AM
Just store it without the zerofill.

Lionel
02-16-2007, 07:18 AM
That's what I ended up doing and when I do a call back to other site I count the digits and simply place the missing zeros in front of it so the link matches.

Marco van Herwaarden
02-16-2007, 08:35 AM
You would not need to count digits, simply format the number with sprintf().