|
| |||||||
![]() | Welcome to iWEBTOOL Talk, where you talk about
webmaster-related stuff.
1 Register
2 Browse the board
3 Discuss whatever may interest you! | |||||||||||||
![]() |
| | Thread Tools | Search this Thread | Display Modes |
| | #1 |
| Contributor Join Date: Jun 2006 Location: Denver
Posts: 4,459
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | I am trying to figure out how to insert a table within another table in mysql. Say for instance: I need a db for authors, so I create a table to include each authors name, then within each authors name, I need another table to list each book title, date of pulication, genre, synopsis, etc. How do I do that? I know how to create a table in PHP, but can't find any documentation on how to do what I am looking for. I went to PHP.net, mysql.org, w3schools, and various other places, so if you have an answer, that would be helpful. |
| |
|
| |||||||
| | #2 |
| Junior Guru Join Date: Jul 2006
Posts: 544
![]() ![]() ![]() ![]() | This may be the reply for this, but have a look at: http://www.webdevelopersnotes.com/tu...ng_tables.php3 EDIT: This one might of some use as well: http://www.php-scripts.com/php_diary/070700.php3 Last edited 07-10-2006 at 12:12 AM. |
| |
| | #3 |
| Contributor Join Date: Jun 2006 Location: Denver
Posts: 4,459
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | Nope, that didn't have a mention of nested tables. I need to have a number that increments everytime a new entry is inserted. Okay, that's easy enough, but it increments no matter who the author is, and that is why I need a nested table. ie.... parent table:email service level1 table1.............level1table2.........................level1table3
id key......................id key.................................id keysome info.................some info............................some info more info.................more info ............................more info Thats the basic structure I am looking for, the parent table can't be the database, it has to be a table. Sorry about the periods(.), I don't know how to format text in forums yet. I need the same structure that is used in computer filing systems, imagine if your computer didn't allow sub-folders, it would be impossible to organize your data(files). I need to organize my information in the same manner that a computer organizes its directories. Last edited 07-10-2006 at 01:52 AM. |
| |
| | #4 |
| Senior Member Join Date: May 2006
Posts: 252
![]() | In MySQL you can't have a table within a table! You should have two tables, one with the list of authors, and the other with a list of books or whatever. To be specific, this is what your tables will look like: Table: authors Fields: id, name Table: books Fields: id, title, pulication_date, genre, synopsis, author_id
__________________ Webmaster News and Daniel's blog can be found at Daniel Malone Free Webmaster Tools |
| |
| | #5 |
| Contributor Join Date: Jun 2006 Location: Denver
Posts: 4,459
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | I wonder why that isn't written anywhere. There was something about ???normalization??? that made no sense, and it took me 4 hours before I figured out a way to do it. Thankyou. |
| |
| | #6 |
| Junior Member Join Date: Aug 2006
Posts: 18
![]() | It is named Table Relationship, you will find it in any good php book. If you read a whole php book, then you will know what php and mysql can do, and if you want to do something only search for the exact syntax of the functions. |
| |
(Threads which have no activity for more than 30 days are automatically closed.) |
| Quick Reply | ||
|
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| New table builder web tool 3w.ezer.com | 123_free_links | Website Reviews | 4 | 06-26-2006 11:26 AM |