Re: database for books question
| From: | Julien Bonastre | Date: | Sun, 22 Jan 2006 00:29:09 +0000 |
| Subject: | Re: database for books question | ||
| References: | 1 2 3 4 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-41109@lists.php.net to get a copy of this message | ||
Flint Million wrote:
Good idea. OK so I'll create a new database with subject ID's. Now, back in the primary database, how can I have multiple subjects assigned to one book? Let's say I repeat my above example and we assign "Nonfiction" to 1, "Technology" to 4, and "Linux" to 5. I know I might be getting off PHP topic here, but what's the best way then to have the database be able to reference multiple subjects per record? Or, would I have to do like "subject0 subject1 subject2 etc." fields considering the maximum number of subjects per book? I still want to be ao search by subject and any book that has that particualr subject assigned to it would be returned.??? Sorry I didn't seem to get this email? Was it posted to the list? In that case you WILL need an intermediatery table then as John proposed. My method works similiar but its a one-to-one relationship per subject Apart from that the rest should follow suite the same.. tata ---oOo--- Allowing users to execute CGI scripts in any directory should only be considered if: ... a.. You have no users, and nobody ever visits your server. ... Extracted Quote: Security Tips - Apache HTTP Server ---oOo--- ------oOo---------------oOo------ Julien Bonastre [The_RadiX] The-Spectrum Network CEO ABN: 64 235 749 494 julien@the-spectrum.org www.the-spectrum.org ------oOo---------------oOo------ ----- Original Message ----- From: "John Meyer" <john.l.meyer@gmail.com> To: "Flint Million" <fmillion@gmail.com>; <php-db@lists.php.net> Sent: Sunday, January 22, 2006 10:14 AM Subject: Re: [PHP-DB] database for books question
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Flint Million wrote:-- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.1.375 / Virus Database: 267.14.21/236 - Release Date: 20/01/2006Good idea. OK so I'll create a new database with subject ID's. Now, back in the primary database, how can I have multiple subjects assigned to one book? Let's say I repeat my above example and we assign "Nonfiction" to 1, "Technology" to 4, and "Linux" to 5. I know I might be getting off PHP topic here, but what's the best way then to have the database be able to reference multiple subjects per record? Or, would I have to do like "subject0 subject1 subject2 etc." fields considering the maximum number of subjects per book? I still want to be ao search by subject and any book that has that particualr subject assigned to it would be returned.Here's how Table: BOOKS BOOK_ID BOOK_NAME .... PK: BOOK_ID SUBJECTS SUBJECT_ID SUBJECT_NAME PK: SUBJECT_ID BOOK_SUBJECT BOOK_ID (references BOOKS) SUBJECT_ID (references SUBJECTS) PK: (BOOK_ID,SUBJECT_ID) -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFD0s5Hj60GAoLuoDkRAlu2AJ4wqmitcKOpSwxiosJIrxHRr4swEACfUy4N biTma4v6Kw5ZWps879Xa9Jg= =D0Nk -----END PGP SIGNATURE----- -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- No virus found in this incoming message. Checked by AVG Anti-Virus. Version: 7.1.375 / Virus Database: 267.14.21/236 - Release Date: 20/01/2006