Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

MySQL &phpMyAdmin Table

Posted on 2013-02-04
6
Medium Priority
?
637 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 1000 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 1000 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
NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

 
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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

Creating a Cordova application which allow user to save to/load from his Dropbox account the application database.
Recursive SQL is one of the most fascinating and powerful and yet dangerous feature offered in many modern databases today using a Common Table Expression (CTE) first introduced in the ANSI SQL 99 standard. The first implementations of CTE began ap…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

916 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