MySQL Forums :: PHP :: One to Many Relationships in MySQL with PHP

Advanced Search

One to Many Relationships in MySQL with PHP
Posted by: Andrew Alsoszatai-Petheo ()
Date: June 06, 2006 05:25PM

I am having problems creating a one-to-many relationship using php and dreamweaver. I currently use SQLYog for my database and easyPHP 1.8 for the servers and Dreamweaver MX 2004 for the Web editing. I have a database of books which I have placed into a php website. It's actually really cool! It functions much like's book database. the part I am missing is authors. In amazon, when you look up a book, it has more that has more than one author, all of the authors names show up. I can only get one to show or get that same book to show several times (as many as there are authors). One book can be written by many authors. I have set up the database in MS Access and have all the tables normalized and the database functions properly. so I exported the database into SQLYog and am using this instead of access. When I set up my database, I can not put in any authors (not because I don't have the knowledge) because I can not set the relationship with the correct tables. Is there a php trick to get this to work or is there a better (free) alternative to SQLYog that can correct this problem.
Here are the tables

Book (Table)

Author (Table)

Wrote (Table)

There are other tables but they are not important to this question

In Access the relationship is:

Book Wrote Author
------ ------- --------
BookNum -1---M- BookNum AuthorFirst
Title AuthorNum -M---1- AuthorNum

Now if I add a book to the Dreamweaver site, I can not add more than one author to a book because the one book repeats itself by however many authors I have for that book. I know for a fact this is either the fact that one to many (1-M) relationships dont exist in SQLYog or there is a php code I am missing.

Please do not hesitate to ask me for any code, more of the database, SQL recordsets in dreamweaver, etc. I am abliged to help you if you help me or at least point me in the correct direction.

you need to use the following credentials:
username: test
password: password

The site is not complete so please don't mind the buttons that don't work.

when you click on the book title it takes you to a detailed page. On this page is where I want the authors to appear. my database file is called "alsoszaa_books"

If possible, would you know how to change checkmarks in a database to yes/no because the CD Included part shows up as 1 or 0

Options: ReplyQuote

Subject Written By Posted
One to Many Relationships in MySQL with PHP Andrew Alsoszatai-Petheo 06/06/2006 05:25PM
Re: One to Many Relationships in MySQL with PHP Thomas Ljungstrom 06/08/2006 04:56AM
Re: One to Many Relationships in MySQL with PHP Afonso Marques 09/26/2006 02:19AM
Re: One to Many Relationships in MySQL with PHP Zaeem Ahmed 06/20/2007 12:01PM
One to Many Relationships in MySQL with PHP Nsovo Mabasa 05/06/2008 02:45PM
Re: One to Many Relationships in MySQL with PHP Imran Nazir 06/27/2007 11:57PM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.