Solved

MySQL &phpMyAdmin Table

Posted on 2013-02-04
6
605 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
Free Gift Card with Acronis Backup Purchase!

Backup any data in any location: local and remote systems, physical and virtual servers, private and public clouds, Macs and PCs, tablets and mobile devices, & more! For limited time only, buy any Acronis backup products and get a FREE Amazon/Best Buy gift card worth up to $200!

 
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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

747 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now