Log in

View Full Version : Resolved mysql and php database (linking data)



john0611
03-11-2009, 05:24 PM
Hi all, I have a mind boggling problem. I will try to explain:

Ok, I have a mysql database, on it I have a few tables one called track-listing with field names, "listingid", "Date", "Title (title of the mix)" and "Listing (track-listings in the mix)".

Now I have a php page called track-listing.php.

I have a div tag which should display the "Title" and "Date" from the database, and I have another div tag that should display the "Listing" from the database.

Now the problem is, I would like to have the "Title" as links so that when you click on the different titles, it displays the Listing data relevant from the database in the other div tag.

Here is a pic to help:)
http://taycondesign.com/Untitled-1.jpg

Hope this makes sence :)

Any help would be greatly appreciated.

Thank you.

Schmoopy
03-11-2009, 06:00 PM
This is where a relational database comes into its own. You will need to make a relation between the track title and the listings for that title.

So you have two tables with the listings and the titles and then you connect the two by having a foreign key in the "listings" table which corresponds to the title of that mix.

I hope you understand :)

john0611
03-11-2009, 10:11 PM
Hi Schmoopy,

That’s great, I kind of know what you mean, but I can't think of the code or set-up to make it all work.

Is there a link I can follow to read up on such info?:)

Many thanks.

John