NamePros
Welcome, Guest! Ready to make a name for yourself in the domain business? We welcome both the hobbyist and professional domainer to join the discussion as part of the NamePros community.

Click here to create your profile to start earning reputation for posting, and trader ratings for buying & selling in our free e-marketplace. Build your trader rating with each successful sale. Our system has tracked over 100,000 sales and counting!
FAQ & TOS Register Search Today's Posts Mark Forums Read

Go Back   NamePros.com > Website Development Discussion Forums > Programming
Reload this Page PHP Basic Help

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.

Advanced Search
5 members in live chat ~  


Closed Thread
 
LinkBack Thread Tools
Old 01-21-2007, 09:45 AM THREAD STARTER               #1 (permalink)
NamePros Regular
Join Date: Aug 2005
Posts: 615
abc123ben is a jewel in the roughabc123ben is a jewel in the roughabc123ben is a jewel in the rough
 




PHP Basic Help


I am currently reading from the PHP and MySQL 2nd Edition Dummies book. And I am kind of stuck on what this means. I seem not to understand it. Any help greatly appreciated. On the book, I am on page 57, and on the section about Variable-length format. It says:

"In this format, MySQL stores the string in a field that is the same length as the string. You still specify a length for the string, but if the string is shorter than the specified length, MySQL only uses the space required rather than leaving the extra space empty. If the string is longer than the space specified, the extra characters are not stored."

OK. So basically, what I think this means is that for instance if the field is specified with a length of 10. If the string is shorter than the specified length, MySQL ignores the extra space required, and uses the string as it is. If the string is longer than the specified space, the extra characters aren't stored.
????: NamePros.com http://www.namepros.com/programming/284281-php-basic-help.html

Well, if that's true, its kind of the same like a fixed-length format, but oh well. If it isn't, please could you correct me. Thanks.

Ben.
__________________
My personal tech blog
abc123ben is offline  
Old 01-21-2007, 09:51 AM   #2 (permalink)
NamePros Regular
 
beaver6813's Avatar
Join Date: May 2005
Location: England
Posts: 390
beaver6813 is a jewel in the roughbeaver6813 is a jewel in the roughbeaver6813 is a jewel in the rough
 




Yup i think you got it.

So if my field has a limit of 10 characters and i enter 5, then it will only store 5 characters and leave the otherrs blank.

If i enter 15 characters though... it will only store the first 10 and cut off the rest.

Just common sense really MySQL isn't out there to confuse you, most of its using your initiative. Good luck with PHP!
beaver6813 is offline  
Old 01-21-2007, 11:31 PM THREAD STARTER               #3 (permalink)
NamePros Regular
Join Date: Aug 2005
Posts: 615
abc123ben is a jewel in the roughabc123ben is a jewel in the roughabc123ben is a jewel in the rough
 




thanks understand it now
__________________
My personal tech blog
abc123ben is offline  
Old 01-21-2007, 11:38 PM   #4 (permalink)
NamePros Regular
 
beaver6813's Avatar
Join Date: May 2005
Location: England
Posts: 390
beaver6813 is a jewel in the roughbeaver6813 is a jewel in the roughbeaver6813 is a jewel in the rough
 




np's
Last edited by beaver6813; 01-21-2007 at 11:41 PM.
beaver6813 is offline  
Old 01-22-2007, 09:02 AM   #5 (permalink)
NamePros Expert
 
Peter's Avatar
Join Date: Nov 2003
Location: Scotland
Posts: 5,074
Peter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond repute
 


Child Abuse Save The Children Save The Children Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009
Originally Posted by beaver6813
Yup i think you got it.

So if my field has a limit of 10 characters and i enter 5, then it will only store 5 characters and leave the otherrs blank.

????: NamePros.com http://www.namepros.com/showthread.php?t=284281
Actually no it is not saying that. The quote states that if the string is shorter than the specified length then the memory used by that field will be the length of the string.

Some types will allocate the maximum memory in the database even if it is empty others will only allocate the used space. This may seem like a trivial difference but if you have a large database it can make a huge amount of different if you are using more space than is required.
Peter is offline  
Old 01-22-2007, 09:09 AM   #6 (permalink)
Senior Member
 
RegisterRants's Avatar
Join Date: Oct 2006
Location: NJ
Posts: 1,147
RegisterRants has a spectacular aura aboutRegisterRants has a spectacular aura aboutRegisterRants has a spectacular aura about
 




Right...there should be no padding characters if you are under the MySQL limitation(s).
__________________
Web Development
RegisterRants is offline  
Old 01-22-2007, 09:46 AM   #7 (permalink)
NamePros Member
Join Date: May 2006
Posts: 160
TwistMyArm is on a distinguished road
 



It's all a matter of speed vs. size. I believe that fixed length strings are slightly quicker to work with as MySQL knows how to 'jump' through the rows instead of having to find the length of each field and go through it that way. I know, it's a really simplistic description but hopefully you get the idea.
TwistMyArm is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


 
All times are GMT -7. The time now is 02:19 PM.

Domain name forum recommended by Domaining.com Powered by: vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.6.0 Ad Management plugin by RedTyger