Numbers not inserting correctly into database? |
[eluser]RyanH[/eluser]
For some reason I can't get phone numbers to insert into the database correctly. It's just in XXXXXXXXXX format, no dashes or anything and no matter what number I enter, it converts it into some other number. The database field type is INT and from the controller file: Code: $rules['phone'] = "numeric|min_length[10]|max_length[10]|trim";
[eluser]RyanH[/eluser]
What do you mean what kind of INT field is it? It's a regular INT field, nothing else. The default says int(11).
[eluser]Seppo[/eluser]
Check the $this->db->last_query() return after inserting the value to find out if it´s a problem on the query or on the storage.
[eluser]xwero[/eluser]
i think you should use a bigint because the range could be too narrow. mysql fieldtypes
[eluser]RyanH[/eluser]
[quote author="xwero" date="1200894820"]i think you should use a bigint because the range could be too narrow. mysql fieldtypes[/quote]That fixed it, thanks! I didn't even think about the fact that it could be approaching the limit and in fact, the limit was the number it was converting it to. Thanks for the help!
[eluser]xwero[/eluser]
FYI i've just changed the exact_count method of the MY_Validation class in the wiki. Now it works for strings and arrays so you don't have to use min_ and maxlength |
Welcome Guest, Not a member yet? Register Sign In |