Solved

MySQL &phpMyAdmin Table

Posted on 2013-02-04
6
613 Views
Last Modified: 2013-02-04
I have a program that dumps data into a MySQL database. This database has tables in it with first name, middle name, and Last name fields. Sometimes, users will have ht eneed to input the last name of Sanchez Jr. or Alder-manz . Basically, there is a chance for hyphens, commas, periods, etc to be in teh middle or last names. My question is, which data field type is better for this VARCHAR or TEXT? At this time I have it set to TEXT but have had some isses with the data getting updated in the table. I'm wondering if I should change it from TEXT to VARCHAR but do not know if it will cause other issues. What are your suggestions or recomendations?
0
Comment
Question by:wantabe2
  • 2
  • 2
  • 2
6 Comments
 
LVL 11

Accepted Solution

by:
SANDY_SK earned 250 total points
ID: 38852251
in my opinion varchar is perfectly fine. The text data type you use only when the data to be stored is very large. that is if it is more than the varchar(MAX)

This link will give you a better idea
http://dev.mysql.com/doc/refman/5.5/en/column-count-limit.html
0
 
LVL 27

Assisted Solution

by:Lukasz Chmielewski
Lukasz Chmielewski earned 250 total points
ID: 38852276
http://www.pythian.com/blog/text-vs-varchar/
Varchar fits, there is no need to store the names for such column data type as text.
0
 
LVL 15

Author Comment

by:wantabe2
ID: 38852379
If I would change this live database from TEXT to VARCHAR at this time, would I need to change anything in the php code? I was going to change the type to VARCHAR with a length to 50. Do you see any issues with that?
0
Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

 
LVL 27

Expert Comment

by:Lukasz Chmielewski
ID: 38852449
For the safe solution I would create a new column, copy the data from text to new varchar and then delete the text one
0
 
LVL 11

Expert Comment

by:SANDY_SK
ID: 38852459
well i am not too sure of PHP but usually there is no difference the way data is read or written to a varchar column or a text column, it is usually the same. So i don't think there will be any problem.

to be on the safer side, you could test it first on a test table and then do it in the live production system
0
 
LVL 15

Author Closing Comment

by:wantabe2
ID: 38852517
Thank you both!
0

Featured Post

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Many companies are looking to get out of the datacenter business and to services like Microsoft Azure to provide Infrastructure as a Service (IaaS) solutions for legacy client server workloads, rather than continuing to make capital investments in h…
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question