I am fairly new to this, so please bare with me on this.

I am designing a database that stores information about the computers I
manage, and am developing a PHP front end to add, view, and edit information
about the computers. One issue I ran into is designing the hard drive
information. Some computers have one hard drive, some have 2, 4, 16, etc. I
am wanting to learn how to deal with this the correct way, so I want to
create a separate table that stores the information about the drives, and
have a foreign key that specifies the computer that owns the drive.

I posted a message on the PHP-DB list, and received an answer that seems
confusing. It told me that I needed InnoDB to be able to deal with this
issue, but in the MySql documentation is says this:"InnoDB provides MySQL
with a transaction-safe (ACID compliant) table handler with commit,
rollback, and crash recovery capabilities." Now having transactions
available would be nice, but that is not my problem now.

Now in another explaination on how to deal with relationships in MySql and
with PHP it shows that you use PHP to deal with the relationships. I always
thought that you let the database deal with the relationships, and not the
application you are writing. Which is correct? I would think that if I
created a relationship between tables, and I called for information on the
computer, I would automatically get all of the drive information. Am I
correct in this? Here is an example of the tables I have:

ComputerTable
    computer_id - primary key
    computer_name
    etc.

HardDriveTable
    drive_id - primary key
    computer_id - foreign key
    drive-capacity
    etc.

If it is better to use the application code, I can do that, but I want to do
things the right way, not necessarily the easiest.


Mike


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to