vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   unsigned zerofill and clean_array_gpc (https://vborg.vbsupport.ru/showthread.php?t=139500)

Lionel 02-15-2007 03:03 PM

unsigned zerofill and clean_array_gpc
 
I have a field in database set as INT (7) unsigned zerofill
The value in there is "0096071".

When I browse to
Quote:

?mid=0096071&do=insert
and in the php do

PHP Code:

$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().


All times are GMT. The time now is 10:29 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01114 seconds
  • Memory Usage 1,724KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (8)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete