Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8022973
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T22:25:28+00:00 2026-06-04T22:25:28+00:00

I have some phone numbers (validated such that all containing only integers, no –

  • 0

I have some phone numbers (validated such that all containing only integers, no - or + in them) as strings in a text file.

I am doing a simple mysql update on a mysql table which has phone number column as int(12). Note that I convert each phone number extracted from the text file to integer using intval().

The problem that I am facing is that instead of the numbers being inserted I just get 2147483647 to be inserted in each column. I guess I am making a small silly mistake somewhere, but still I can’t figure it out. Can anyone explain what mistake am I making?

EDIT: Here is my the piece of code I am using (It does not give any sql error):

$sql="UPDATE ".$table." SET mobile = ".intval($smob).", phone = ".intval($sphone)." WHERE roll='".$sroll."'";
mysql_query($sql, $con) or die(mysql_error());
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T22:25:30+00:00Added an answer on June 4, 2026 at 10:25 pm

    Excerpt from intval() manual:

    The maximum value depends on the system. 32 bit systems have a maximum signed integer range of -2147483648 to 2147483647. So for example on such a system, intval(‘1000000000000’) will return 2147483647. The maximum signed integer value for 64 bit systems is 9223372036854775807.

    What you are getting is a maximum number for signed integer on a 32bit machine.

    I would strongly advise you to not use this function for phone number conversions. One of the simple reasons is that my mobile number is 11 digit number (without leading + or double zero for international access), and I believe there are some countries that have even more digits.

    Why you would need to store phone numbers as int‘s? Since most likely you are not doing some calculations and statistics on who might have a biggest phone number among your clients, and this data is probably used only for invoicing or a contact info, you could just leave that as a string.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my application I have some phone numbers, so that the users can call
I have written a PHP application that broadcasts a voice message to phone numbers
I have a Silverlight application in which I display some phone numbers. I want
I've got some textfiles that hold names, phone numbers and region codes. One combination
I have a form containing some dynamic elements. These are basically text input boxes
I have a bunch of phone numbers in a DB that are formatted as
I have some examples on phone number, as shown below: 0810-093-485-58 0811.4845.5677 0812 567
Say I have a Date, or a Phone number, or some Class which I
i have some fields in my database table,and a field with phone name ,
I'm working on a windows phone project where I have some xml files with

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.