Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions

Reply
 
Thread Tools Display Modes
  #21  
Old 12-18-2004, 10:19 PM
AN-net's Avatar
AN-net AN-net is offline
 
Join Date: Dec 2003
Location: AnimationTalk.com
Posts: 2,367
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

anyone know y?
Reply With Quote
  #22  
Old 12-18-2004, 10:38 PM
Paul M's Avatar
Paul M Paul M is offline
 
Join Date: Sep 2004
Location: Nottingham, UK
Posts: 23,748
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You have the field defined as a signed interger - the maximum value for a signed integer field in mysql is 2147483647, if you try and put anything bigger than this in, it will just set the field to this maximum value.
Reply With Quote
  #23  
Old 12-18-2004, 11:17 PM
AN-net's Avatar
AN-net AN-net is offline
 
Join Date: Dec 2003
Location: AnimationTalk.com
Posts: 2,367
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Paul M
You have the field defined as a signed interger - the maximum value for a signed integer field in mysql is 2147483647, if you try and put anything bigger than this in, it will just set the field to this maximum value.
put since the number is say 9087060766 and the field is sent to 11 interger it shouldnt overflow it....
Reply With Quote
  #24  
Old 12-18-2004, 11:19 PM
filburt1 filburt1 is offline
 
Join Date: Feb 2002
Location: Maryland, US
Posts: 6,144
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by AN-net
put since the number is say 9087060766 and the field is sent to 11 interger it shouldnt overflow it....
That has nothing to do with the length. An unsigned integer is only allocated a given number of bytes by MySQL. You need to use a long or other higher-capacity data type. If you're storing phone numbers or other non-purely-numerical data, use a string.
Reply With Quote
  #25  
Old 12-18-2004, 11:21 PM
AN-net's Avatar
AN-net AN-net is offline
 
Join Date: Dec 2003
Location: AnimationTalk.com
Posts: 2,367
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by filburt1
That has nothing to do with the length. An unsigned integer is only allocated a given number of bytes by MySQL. You need to use a long or other higher-capacity data type. If you're storing phone numbers or other non-purely-numerical data, use a string.
oh ok, so its because of the number size that was messing msysql up. many thanks to all who helped
Reply With Quote
  #26  
Old 12-18-2004, 11:26 PM
AN-net's Avatar
AN-net AN-net is offline
 
Join Date: Dec 2003
Location: AnimationTalk.com
Posts: 2,367
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

ok i changed the field to tinytext but its still doing it, could it be because the server or intval() is being overwhelmed by the #?
Reply With Quote
  #27  
Old 12-18-2004, 11:39 PM
Paul M's Avatar
Paul M Paul M is offline
 
Join Date: Sep 2004
Location: Nottingham, UK
Posts: 23,748
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by AN-net
oh ok, so its because of the number size that was messing msysql up. many thanks to all who helped
It's not messing mysql up - you are simply trying to fit a number bigger than 32 bits into a 32 bit hole.


Quote:
Originally Posted by AN-net
ok i changed the field to tinytext but its still doing it, could it be because the server or intval() is being overwhelmed by the #?
Like most interger functions intval() can only handle numbers up to 32 bits.
Reply With Quote
  #28  
Old 12-19-2004, 02:14 AM
AN-net's Avatar
AN-net AN-net is offline
 
Join Date: Dec 2003
Location: AnimationTalk.com
Posts: 2,367
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Paul M
It's not messing mysql up - you are simply trying to fit a number bigger than 32 bits into a 32 bit hole.


Like most interger functions intval() can only handle numbers up to 32 bits.
so how can i store phone numbers and makesure it us a number?
Reply With Quote
  #29  
Old 12-19-2004, 02:22 AM
filburt1 filburt1 is offline
 
Join Date: Feb 2002
Location: Maryland, US
Posts: 6,144
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Do not treat a phone number as a literal number, especially because the format varies by country. Store it as a string, unless your PHP script connects to a phone and calls it. You can always use regular expressions to parse it to whatever form you want later.

For the US, you can store it as nnn-nnn-nnnn, including the dashes.
Reply With Quote
  #30  
Old 12-19-2004, 02:56 AM
AN-net's Avatar
AN-net AN-net is offline
 
Join Date: Dec 2003
Location: AnimationTalk.com
Posts: 2,367
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by filburt1
Do not treat a phone number as a literal number, especially because the format varies by country. Store it as a string, unless your PHP script connects to a phone and calls it. You can always use regular expressions to parse it to whatever form you want later.

For the US, you can store it as nnn-nnn-nnnn, including the dashes.
what type of field in mysql should i use? and ill assume not to use intval() on the entire number?
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 12:43 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.15065 seconds
  • Memory Usage 2,252KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (7)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (3)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete