Jump to content

not storing mobile numbers properly...


mandrill

Recommended Posts

I'm trying to store mobile phone numbers in a database as the VARCHAR data type but they keep getting stored as 2147483647. There's no problems with landline numbers (which start with 01 in my country) but mobile numbers (07etc.) seem to be problematic. Is there anyway I can force MySQL to store it as a string rather than an integer? I've tried changing the data type (All the INTs unsigned with zerofill, VARCHAR, CHAR, all the TEXTS, and the various BLOBs) and it always stores them as 2147483647. Any advice would be most appreciated as I've been tearing my hair out over this for the last two days.
Link to comment
Share on other sites

I went through the code with a fine toothed comb and found this:
[code]$insertSQL = sprintf("INSERT INTO customers (CustomerNumber, Title, Address, Surname, WorkNumber, HomeNumber, MobileNumber, Notes) VALUES (%s, %s, %s, %s, %s, %s, %s, %s)",
                      GetSQLValueString($custID, "text"),
  GetSQLValueString($_POST['title'], "text"),
                      GetSQLValueString($_POST['address'], "text"),
                      GetSQLValueString($_POST['surname'], "text"),
                      GetSQLValueString($_POST['worknumber'], "int"),
                      GetSQLValueString($_POST['homenumber'], "int"),
                      GetSQLValueString($_POST['mobilenumber'], "int"),
                      GetSQLValueString($_POST['notes'], "text"));
[/code]
I feel like an idiot. I changed the int's to text's and now it works fine. Thanks anyway :)
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.