Why would MYSQL not post data right?? Wtf?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • xxweekxx
    Confirmed User
    • Oct 2002
    • 6780

    #1

    Why would MYSQL not post data right?? Wtf?

    OK, well got a mortgage page, Phone # has to be 10 digits and it has error checking.. Well, i noticed that somehow the data is getting lost.. Like you type in 111-111-1111 and 90% of the time mysql will post it well. other 10%, it'll just show 111-111-111..

    How does 1 digit of the # get lost like that?? make any sense to anyone?

    Also, about 5% of time i get this error..

    warning: mysql_connect(): Lost connection to MySQL server during query in /www/users/xxxx/post.php on line 2

    warning: mysql_select_db(): supplied argument is not a valid MySQL-Link resource in /www/users/xxxx/post.php on line 3

    warning: mysql_close(): supplied argument is not a valid MySQL-Link resource in /www/users/xxxx/post.php on line 10
    _________________
    I am the best
  • xxweekxx
    Confirmed User
    • Oct 2002
    • 6780

    #2
    _________________
    I am the best

    Comment

    • eMonk
      Confirmed User
      • Aug 2003
      • 2310

      #3
      mysql ownz joo!

      Comment

      • xxweekxx
        Confirmed User
        • Oct 2002
        • 6780

        #4
        ok that helps a lot.
        _________________
        I am the best

        Comment

        • labeledas
          Registered User
          • Oct 2002
          • 74

          #5
          that's weird what is the column type VARCHAR

          Comment

          • galleryseek
            Confirmed User
            • Mar 2002
            • 8234

            #6
            i highly suggest taking that "I own you." line out of your signature lol.

            Comment

            • xxweekxx
              Confirmed User
              • Oct 2002
              • 6780

              #7
              Originally posted by labeledas
              that's weird what is the column type VARCHAR
              for phone # its integer
              _________________
              I am the best

              Comment

              • Pete-KT
                Workin With The Devil
                • Oct 2004
                • 51532

                #8
                Is it a certain number that it cuts out? or just randomly seems like maybe if there is a space in the box its not grabbign everything, change it so the box adds one more space to report to you. and see if that fixes it

                Comment

                • xxweekxx
                  Confirmed User
                  • Oct 2002
                  • 6780

                  #9
                  Originally posted by galleryseek
                  i highly suggest taking that "I own you." line out of your signature lol.

                  LOL i will soon.
                  _________________
                  I am the best

                  Comment

                  • xxweekxx
                    Confirmed User
                    • Oct 2002
                    • 6780

                    #10
                    Originally posted by Pete-KT
                    Is it a certain number that it cuts out? or just randomly seems like maybe if there is a space in the box its not grabbign everything, change it so the box adds one more space to report to you. and see if that fixes it

                    its cutting out last digit
                    _________________
                    I am the best

                    Comment

                    • galleryseek
                      Confirmed User
                      • Mar 2002
                      • 8234

                      #11
                      just make the type TEXT and don't specify a char limit.

                      Comment

                      • xxweekxx
                        Confirmed User
                        • Oct 2002
                        • 6780

                        #12
                        Wait i found out whats wrong.. if the # is a 0 before it, it cuts it out

                        Example

                        732-888-0222

                        Wil be reported as 732-888-222

                        How do i fix this?
                        _________________
                        I am the best

                        Comment

                        • labeledas
                          Registered User
                          • Oct 2002
                          • 74

                          #13
                          OR VARCHAR(255) integer is a bitch with non numerical characters

                          Comment

                          • labeledas
                            Registered User
                            • Oct 2002
                            • 74

                            #14
                            and seems useless for phone numbers

                            Comment

                            • xxweekxx
                              Confirmed User
                              • Oct 2002
                              • 6780

                              #15
                              cuz i have it set as
                              PhoneArea
                              PhonePrefix
                              PhoneSuffix

                              so if u got 222-494-02222

                              It becomes 222-494-222
                              _________________
                              I am the best

                              Comment

                              • xxweekxx
                                Confirmed User
                                • Oct 2002
                                • 6780

                                #16
                                _________________
                                I am the best

                                Comment

                                • Serge Litehead
                                  Confirmed User
                                  • Dec 2002
                                  • 5190

                                  #17
                                  Originally posted by xxweekxx
                                  for phone # its integer


                                  seems like you have mysql connectivity problems, this might be due to high bandwidth or low on free resources of the server, i never got that error myself though..

                                  if you want to keep leading zeros like 0222 you have to add 1000 then replace one with zero before mysql query.. by default php cuts leading zeros.. there are some other tricks in getting around this i dont remember now.

                                  Comment

                                  • Pete-KT
                                    Workin With The Devil
                                    • Oct 2004
                                    • 51532

                                    #18
                                    change it to text instead of integer that should fix it

                                    Comment

                                    • xxweekxx
                                      Confirmed User
                                      • Oct 2002
                                      • 6780

                                      #19
                                      Originally posted by holograph
                                      seems like you have mysql connectivity problems, this might be due to high bandwidth or low on free resources of the server, i never got that error myself though..

                                      if you want to keep leading zeros like 0222 you have to add 1000 then replace one with zero before mysql query.. by default php cuts leading zeros.. there are some other tricks in getting around this i dont remember now.
                                      hmm
                                      _________________
                                      I am the best

                                      Comment

                                      • Serge Litehead
                                        Confirmed User
                                        • Dec 2002
                                        • 5190

                                        #20
                                        easiest way around to parse phone# as a string not as an integer.

                                        Comment

                                        • xxweekxx
                                          Confirmed User
                                          • Oct 2002
                                          • 6780

                                          #21
                                          I changed it to Varchar and it works now.. I can put leading zeros.

                                          Thanks people..
                                          _________________
                                          I am the best

                                          Comment

                                          • Pete-KT
                                            Workin With The Devil
                                            • Oct 2004
                                            • 51532

                                            #22
                                            anytime and now you can send us each 100 dollars for fixing it ;)

                                            Comment

                                            • BadBrad
                                              Confirmed User
                                              • Feb 2004
                                              • 618

                                              #23
                                              Any text item you want to return as a string needs to be put in a varchar.

                                              phone varchar(15) NOT NULL default ''
                                              Your sig chose me!

                                              Comment

                                              • nastyking
                                                • Nov 2002
                                                • 2174

                                                #24
                                                Originally posted by xxweekxx
                                                cuz i have it set as
                                                PhoneArea
                                                PhonePrefix
                                                PhoneSuffix

                                                so if u got 222-494-02222

                                                It becomes 222-494-222
                                                are you serious?

                                                p.s. use varchar or are you going to perform arithmetic operations on the phone number?

                                                Comment

                                                • venturi
                                                  Confirmed User
                                                  • Aug 2001
                                                  • 386

                                                  #25
                                                  Set the field to VARCHAR(25)

                                                  That should handle all international phone numbers easily. VARCHAR(16) *should* handle things but people are weird when they type phone numbers.

                                                  DO NOT make it a TEXT field if you want it to be easily indexed. I see morons constantly that use TEXT as the default field type in mySQL. Not only is it cumbersome to index without performance hits, it takes up horrendous amounts of space in the database as it reserves 64K per row.

                                                  A phone number should never be set to TEXT in mySQL.
                                                  I'm not a porn monger. I'm a porn ... STYLIST!
                                                  Buildit Cheap, build it Fast, Build it Right. - Pick Two.

                                                  Comment

                                                  • Nathan
                                                    Confirmed User
                                                    • Jul 2003
                                                    • 3108

                                                    #26
                                                    He is doing mortgage stuff, that is why he wants it in 3 blocks so he can make sure he can target it well and make sure the checks are all fine. He probably also has 3 form fields for it.

                                                    If you really want to store it as integers, then to build the number after getting it from mySQL use this:

                                                    $phonenumber = sprintf('haha3d-haha3d-haha4d', $row['PhoneArea'], $row['PhonePrefix'], $row['PhoneSuffix']);
                                                    "Think about it a little more and you'll agree with me, because you're smart and I'm right."
                                                    - Charlie Munger

                                                    Comment

                                                    Working...