![]() |
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 |
:warning
|
mysql ownz joo! :1orglaugh :1orglaugh :1orglaugh
|
ok that helps a lot.
|
that's weird what is the column type VARCHAR
|
i highly suggest taking that "I own you." line out of your signature lol.
|
Quote:
|
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
|
Quote:
LOL i will soon. :helpme |
Quote:
its cutting out last digit |
just make the type TEXT and don't specify a char limit.
|
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? |
OR VARCHAR(255) integer is a bitch with non numerical characters
|
and seems useless for phone numbers
|
cuz i have it set as
PhoneArea PhonePrefix PhoneSuffix so if u got 222-494-02222 It becomes 222-494-222 |
:warning
|
Quote:
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. |
change it to text instead of integer that should fix it
|
Quote:
|
easiest way around to parse phone# as a string not as an integer.
|
I changed it to Varchar and it works now.. I can put leading zeros.
Thanks people.. |
anytime and now you can send us each 100 dollars for fixing it ;)
|
Any text item you want to return as a string needs to be put in a varchar.
phone varchar(15) NOT NULL default '' |
Quote:
p.s. use varchar or are you going to perform arithmetic operations on the phone number? |
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. |
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']); |
All times are GMT -7. The time now is 10:53 AM. |
Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123