[英]Codeigniter and Tank Auth - new registration field being incorrectly added to database?
I've created a new field in the registration form: 我在注册表中创建了一个新字段:
//goes on top of page along with other form vars
$phone = array(
'name' => 'phone',
'id' => 'phone',
'value' => set_value('phone'),
'maxlength' => $this->config->item('phone_max_length', 'tank_auth'),
'size' => 30,
);
//inserted into form
<?php echo form_label('Phone number', $phone['id']); ?>
<?php echo form_input($phone); ?>
<?php echo form_error($phone['name']); ?>
And I've updated the register controller in the necessary places, 我已经在必要的地方更新了注册控制器,
as well as updating the Tank Auth library in rootdir/application/libraries/Tank_auth.php
以及更新
rootdir/application/libraries/Tank_auth.php
的Tank Auth库
I've also created a phone column in the users table. 我还在用户表中创建了一个电话栏。 However, say the mobile phone input was 07879526831, in the table it ends up as 2147483647!
但是,假设手机输入为07879526831,在表中该数字最终为2147483647! Really weird, and I have no clue why.
真的很奇怪,我也不知道为什么。 Anyone has any ideas?
有人有什么想法吗?
2147483647 is the largest value that can be stored in a signed 32-bit integer. 2147483647是可以存储在带符号的32位整数中的最大值。 For a phone number, assuming you have a fixed set of characters, try using a char(10) for example.
对于电话号码,假设您有一组固定的字符,请尝试使用char(10)例如。 Or you could use a varchar, if your phone numbers will be stored with varying lengths.
或者,如果您的电话号码以不同的长度存储,则可以使用varchar。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.