Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Extended features, pros & cons?

Status
Not open for further replies.

sysadmin42

Technical User
May 6, 2005
138
I know that there are a lot of extended features out there within a MySQL db, such as linking the primary ids of a table. When using MySQL with PHP, is it really necessary to go through these extra steps to set up? what are the benefits and downfalls to using these features?

"Computer illiterate is a dirty word."
 
your question isn't quite clear. what are you asking specifically how to set up your tables and what information needs to be there vs what information can be there such as indexing, foreign keys etc? if you are asking that, the fact that you are using PHP to interface is irrelevant, you should set up your tables in the necessary manner to interact with your data, you could swap out PHP for PERL, JAVA, C, C++ etc. and none of those should have an impact on how you set up your tables.
 
sysadmin42, please let me know how you feel about the following summary --

benefits: data integrity

downfalls: none


:)


r937.com | rudy.ca
 
I agree with you. Data integrity is important...

I guess what I'm asking is this: how does linking two tables together matter through MySQL definitions if I already know this and write my programs with it anyway?

example:
I write a program that looks up the data in "People" based on the ID number of "Companies":

Table "Companies":
company_id
name
address
phone

Table "People":
people_id
company_id <-- lookup field
name
etc.

So I use my software to realize that company_id corresponds to the table "Companies," yet I don't define this in MySQL explicitly. What reason is there that I should define the relationship explicitly in MySQL?

"Computer illiterate is a dirty word."
 
because some day you may find a reason to access the database without going through your program

the data will still be protected from errors you might introduce inadvertently

r937.com | rudy.ca
 
that makes sense. So it should be a standard rule of thumb to do this. Good idea.

I will incorporate this into my work from now on. Thanks for the help!

"Computer illiterate is a dirty word."
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top