Hi guys,
I am having trouble with a loop query. My initial query was resolved in this thread however I want to display the data slightly differently which is causing me some problems.
Allow me to set the scene:
I have a database with 3 tables (Library, Shelf & Book) as seen here:
http://www.alistairmahoney.com/z_sgoldie/my_tables.html
When I run a standard JOIN query against all 3 tables I get these results:
http://www.alistairmahoney.com/z_sgoldie/my_result.html
Now, I want to know what kind of PHP Loop I would need to write to get my results to look like this (or something similar) on an HTML page:
Green Library
Shelf A: Book 1, Book 7, Book 13, Book19
Shelf B: Book 2, Book 8, Book 14, Book 20
Address: 123 Green Street, Greensville
Opening Hours: 9am - 5pm
Blue Library
Shelf C: Book 3, Book 9, Book 15, Book 21
Shelf D: Book 4, Book 10, Book 16
Address: 456 Blue Road, Bluetown
Opening Hours: 8am - 6pm
Yellow Library
Shelf E: Book 5, Book 11, Book 17
Shelf F: Book 6, Book 12, Book 18
Address: 789 Yellow Lane, Yellopolis
Opening Hours: 9am - 2pm
In my previous thread someone showed me how to do it so my results would display the books at the end of each library results, but I want to know how to display them so that they are in the middle of each library result (I hope that makes sense). Cheers!
Attached is my DB code if required.