PDA

View Full Version : Need some help with code


Parker Clack
11-25-2007, 09:54 PM
I am trying to add a field to input a 16 digit number and all I am getting back is 10 digits.

I have the user table set up so that I have the type set up for the bob row at char(20). I have the plugin set for profile_updateprofile hook as


$vbulletin->input->clean_array_gpc('p', array(
'bob' => TYPE_INT,
));

$userdata->set('bob', $vbulletin->GPC['bob']);


and I have the userdate_start hook set as:


$this->validfields['bob'] = array(TYPE_INT, REQ_NO);


I have the tempate set so that I am inputing the data as


<tr><td>Bob Address: (No Spaces) <br />
<input type="text" class="bginput" name="bob" value="$bbuserinfo[bob]" size="50" maxlength="200" dir="ltr" /></td>
</tr>


So when I put in a 16 digit number I get back on 10 digits. What do I need to change
so that I can put in a 16 or larger number and not have it cut off?

Thanks,
Parker

Lynne
11-25-2007, 10:00 PM
The maximum number allowed in an INT field is "2147483647" (or "4294967295", depending) which is only 10 digits. I think you may want to use a BIGINT or a VARCHAR for your number. (ref: http://dev.mysql.com/doc/refman/5.0/en/numeric-types.html)

Parker Clack
11-26-2007, 01:53 AM
Thanks Lynne. I figured it out. I needed to use TYPE_STR instead of INT.

calorie
11-26-2007, 03:02 AM
You better use TYPE_NOHTML so $bbuserinfo['bob'] is not open to XSS issues.