MySQL &phpMyAdmin Table

Posted on 2013-02-04
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?
Question by:wantabe2
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
LVL 11

Accepted Solution

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
LVL 27

Assisted Solution

by:Lukasz Chmielewski
Lukasz Chmielewski earned 250 total points
ID: 38852276
Varchar fits, there is no need to store the names for such column data type as text.
LVL 15

Author Comment

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?
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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
LVL 11

Expert Comment

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
LVL 15

Author Closing Comment

ID: 38852517
Thank you both!

Featured Post

Guide to Performance: Optimization & Monitoring

Nowadays, monitoring is a mixture of tools, systems, and codes—making it a very complex process. And with this complexity, comes variables for failure. Get DZone’s new Guide to Performance to learn how to proactively find these variables and solve them before a disruption occurs.

Question has a verified solution.

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

Suggested Solutions

When table data gets too large to manage or queries take too long to execute the solution is often to buy bigger hardware or assign more CPUs and memory resources to the machine to solve the problem. However, the best, cheapest and most effective so…
A company’s centralized system that manages user data, security, and distributed resources is often a focus of criminal attention. Active Directory (AD) is no exception. In truth, it’s even more likely to be targeted due to the number of companies …
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…
The viewer will learn how to count occurrences of each item in an array.

739 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