|
|||||||
New to SitePoint Forums? Register here for free!
|
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
SitePoint Member
Join Date: Nov 2006
Posts: 3
|
Data formatting help please
Hi all this is my first post. I've just started getting into PHP/MySQL after a couple of years of using .NET (urgh)..
I'm building a MP3 store for a record label. There are multile Artists who each have multiple Records and each Record has multiple Tracks. I've got everything working except for the checkout page where I want to display the data slightly differently to the rest of the site. The 4 main tables involved are are: cart - cartId (primary key) - cookieId (session value) - itemId (joins tracks.id) tracks - id (primary key) - artist_id (relates to artists.id) - record_id (relates torecords.id) - number (value) - name (value) records - id (primary key) - artist_id (relates to artists.id) - record_name (value) - released (value) artists - id (primary key) - artists_name (value) - description (value) So basically on the checkout page I want to querry the cart table to pull out all the unique track ids a user has selected, from there I can find the artist, record for each track! I can display the data easily as follows: Artist Name1 Record Name1 Track1 Artist Name1 Record Name1 Track2 Artist Name1 Record Name2 Track1 (See below for the code I used to do this) But I would prefer to list as: Artist Name 1 Record Name 1 - Track 1 - Track 2 Artist Name 1 Record Name 2 - Track 1 - Track 2 Artist Name 2 Record Name 1 - Track 1 - Track 2 I hope that makes sense!! Below is the querry I used to join the tables and retrieve the data I potentially need. I'm thinking it may be more of a PHP coding issue to get the formatting correct? I do appear to be getting back all the relevant data I need. PHP Code:
PHP Code:
Thanks, Dominic |
|
|
|
| Bookmarks |
«
Previous Thread
|
Next Thread
»
| Thread Tools | |
| Display Modes | |
|
|
|
All times are GMT -7. The time now is 01:23.








Threaded Mode