GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   Why would MYSQL not post data right?? Wtf? (https://gfy.com/showthread.php?t=433748)

xxweekxx 02-18-2005 11:46 PM

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

xxweekxx 02-18-2005 11:49 PM

:warning

eMonk 02-18-2005 11:50 PM

mysql ownz joo! :1orglaugh :1orglaugh :1orglaugh

xxweekxx 02-18-2005 11:51 PM

ok that helps a lot.

labeledas 02-18-2005 11:55 PM

that's weird what is the column type VARCHAR

galleryseek 02-18-2005 11:56 PM

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

xxweekxx 02-18-2005 11:57 PM

Quote:

Originally Posted by labeledas
that's weird what is the column type VARCHAR

for phone # its integer

Pete-KT 02-18-2005 11:57 PM

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

xxweekxx 02-18-2005 11:57 PM

Quote:

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


LOL i will soon. :helpme

xxweekxx 02-18-2005 11:58 PM

Quote:

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

galleryseek 02-18-2005 11:59 PM

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

xxweekxx 02-19-2005 12:00 AM

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?

labeledas 02-19-2005 12:00 AM

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

labeledas 02-19-2005 12:01 AM

and seems useless for phone numbers

xxweekxx 02-19-2005 12:01 AM

cuz i have it set as
PhoneArea
PhonePrefix
PhoneSuffix

so if u got 222-494-02222

It becomes 222-494-222

xxweekxx 02-19-2005 12:06 AM

:warning

Serge Litehead 02-19-2005 12:10 AM

Quote:

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.

Pete-KT 02-19-2005 12:11 AM

change it to text instead of integer that should fix it

xxweekxx 02-19-2005 12:11 AM

Quote:

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 :warning

Serge Litehead 02-19-2005 12:13 AM

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

xxweekxx 02-19-2005 12:16 AM

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

Thanks people..

Pete-KT 02-19-2005 12:17 AM

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

BadBrad 02-19-2005 02:41 AM

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

phone varchar(15) NOT NULL default ''

nastyking 02-19-2005 02:47 AM

Quote:

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

:1orglaugh :1orglaugh are you serious?

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

venturi 02-19-2005 04:33 AM

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.

Nathan 02-19-2005 04:48 AM

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