Categories > TinyButStrong general >

How to realise one to many relationships

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: Sebastian
Date: 2005-04-11
Time: 11:47

How to realise one to many relationships

First of all thanks a lot for tinybutstrong. I have just started programming with php and I wonder how you could realise the output of data from a mysql database from a one-to-many relationship situation as a table where the last column lists all the data from the detail table (n-side).
Example:

AuthorId1, AuthorName1,BookTitle1
AuthorId1, AuthorName1,BookTitle2
AuthorId1, AuthorName1,BookTitle3
AuthorId1, AuthorName1,BookTitle4
AuthorId2, AuthorName2,BookTitle1
AuthorId2, AuthorName2,BookTitle2
...
There would be a author table and a book table with the author id as foreign key. Thanks for you help.

Sebastian
By: Skrol29
Date: 2005-04-11
Time: 17:14

Re: How to realise one to many relationships

Hi Sebastian,

If you just need a simple display, you can do it with one query joining the two tables and a grouping section on the Html side (see online examples).
Otherwise, you can use sub-blocks. There is an online example too for that.