I'm not extremely well versed in MySQL... this may end up being a fundamental or basic in database design and implementation. (by the way I'm using PHP)
I'll give the trimmed down example of what I'm working with:
The problem is that each story has multiple authors and each author has written multiple stories.
So I don't know if I need to rethink my database structure or understand something different about how the tables can work together, but my IDEA of how I want to display it / make it work would be:
An HTML Table that displays the list of stories would look like:
But in the database the AUTHORS field is "2,6" to reference authors of id "2" and "6" then select their name and display it in this case.
I've been reading about INNER JOIN and JOINS in general, but I guess I just can't get my head around it yet.
I'll give the trimmed down example of what I'm working with:
Code:
Story Table id title authors datewritten
Code:
Authors Table id username password name
So I don't know if I need to rethink my database structure or understand something different about how the tables can work together, but my IDEA of how I want to display it / make it work would be:
An HTML Table that displays the list of stories would look like:
Code:
Date Title Authors 12 Dec 2007 Adventures of an Alien Mike Smith, Tom Johnson 24 Jan 2008 Where Pride Went Tom Johnson, Dan Walters
I've been reading about INNER JOIN and JOINS in general, but I guess I just can't get my head around it yet.
Comment