View Full Version : Need some help, probably simple to do.

12-16-2007, 11:27 PM
I have a site that has an index page with a list of music artists, when you click on an artist it takes you to artistdetail.php with the title of the album, artwork and tracklisting, this all works fine but I want to have on this page a section that has the artists other albums that this artist has done. You then click on another album and that page opens, I just can't seem to figure out how to make this work.

My table structure is this:
Table 1 is called Album and has - album_id, artist_id, album_name, album_year, album_image, album_tracklist

Table 2 is called artist and has - album_id, artist_id, artist

12-17-2007, 05:49 AM
hand coded or dreamweaver coded?

12-17-2007, 12:30 PM
dreamweaver coded, I'am using the server behaviours

12-17-2007, 12:35 PM
hi mr badger

i cant help with this. Sorry. This is a hand coding forum

If you ever want to develop your programming skills let me know

will move this post to a forum where you may find assistance

12-18-2007, 12:50 AM
post some code

12-18-2007, 12:28 PM
<?php require_once('Connections/albums.php'); ?>
$colname_getAlbumDetails = "-1";
if (isset($_GET['album_id'])) {
$colname_getAlbumDetails = (get_magic_quotes_gpc()) ? $_GET['album_id'] : addslashes($_GET['album_id']);
mysql_select_db($database_albums, $albums);
$query_getAlbumDetails = sprintf("SELECT * FROM album WHERE album.album_id = %s ", $colname_getAlbumDetails);
$getAlbumDetails = mysql_query($query_getAlbumDetails, $albums) or die(mysql_error());
$row_getAlbumDetails = mysql_fetch_assoc($getAlbumDetails);
$totalRows_getAlbumDetails = mysql_num_rows($getAlbumDetails);

mysql_select_db($database_albums, $albums);
$query_getOtherAlbums = "SELECT artist.artist_id, album.album_id, album.artist_id, album.album_image FROM artist, album WHERE album.album_id = artist.artist_id ORDER BY album.album_image";
$getOtherAlbums = mysql_query($query_getOtherAlbums, $albums) or die(mysql_error());
$row_getOtherAlbums = mysql_fetch_assoc($getOtherAlbums);
$totalRows_getOtherAlbums = mysql_num_rows($getOtherAlbums);

<div id="album_detail">
<p>Artist - <?php echo $row_getAlbumDetails['artist_id']; ?><br />
<br />
Album - <?php echo $row_getAlbumDetails['album_name']; ?><br />
<br />
Released - <?php echo $row_getAlbumDetails['album_year']; ?><br />
<br />
<img src="album_artwork/<?php echo $row_getAlbumDetails['album_image']; ?>" border="1" /></p>
<p>Tracklist:<br />
<?php echo nl2br ($row_getAlbumDetails['album_tracklist']); ?></p>
<p>Related Albums:</p>

<?php do { ?>
<table width="50" border="0" cellspacing="5" cellpadding="2">
<th scope="col"><img src="album_artwork/<?php echo $row_getOtherAlbums['album_image']; ?>" /></th>
<?php } while ($row_getOtherAlbums = mysql_fetch_assoc($getOtherAlbums)); ?><p>&nbsp; </p>

Hope this helps, this code is on the artistdetail.php page.

12-19-2007, 01:04 AM
this is a really good example of Davids desire to educate us into spitting out the dreamweaver dummy and learn to code php.

I have a learner plate on myself but as I see it :

$_GET['album_id']is your selector from a form. this brings your first records

so your second recordset will have to select where artist_id = $row_getAlbumDetails['artist_id'].

The do loop will fetch all records from that artist. Thats the logic as I see it anyway

12-19-2007, 05:53 AM
dont think that will help him as you have used code to explain a solution to someone who cant code
you have to write the solution for him
you have to supply an extension or point him in the direction of onemr badger

you now can see why you should learn to code

12-19-2007, 07:13 AM
I don't disagree david, definitely better.

12-19-2007, 08:28 AM
hey mr_badger,

if you're not looking to learn to hand code the site then it's worth while learning how you properly use the software you've bought.

this is a link to a dreamweaver blog tutorial. if you go through it and create the blog you will learn a great deal about the software you have bought and its capabilities.

whilst completing the tutorial think about how you can implement what you have learned into your own site.

linky: http://www.adobe.com/devnet/dreamweaver/articles/php_blog1.html

12-19-2007, 01:38 PM
thanks for the reply, I will do the blog tutorial. I have tried to do the hand coding but it's hard and just found doing it all with dreamweaver server behaviors easier to understand.

12-19-2007, 01:41 PM
I have tried to do the hand coding but it's hard and just found doing it all with dreamweaver server behaviors easier to understand

not when you get yourself in a pickle like now

12-29-2007, 05:20 PM
ok I have done the blog tutorial which works fine but I'm still having trouble with displaying the artist albums.

I have had it to the point where it will display the correct album but only one album and no others.
I have also now got it to the point where I have created a recordset called rsAlbums which when I test it in the simple dialog it shows all the albums produced for the artist but when I create the recorset it doesn't display anything?

This is my recordset
FROM artist_album
WHERE idartist_album = colname
ORDER BY id_album ASCcolname = idartist_album

my mysql tables are:
[artist album] with fields - id_album, idgenre_album, idartist_album, description_album, tracklist_album, artwork_album, released-album.

[artist_artist] with fields - id_artist, idgenre_artist, artist, description_artist, artist_image, text_artist

[artist_genre] with fields - id_genre, title_genre, description_genre

Hope someone can help me with this.

12-31-2007, 12:28 AM
how is the recorset choosing the criteria? in your filter are you choosing the form submission?

12-31-2007, 01:13 PM
no, by url parameter.

01-02-2008, 12:32 AM
then your second record set needs $_GET['album_id'] the same as the first recordset

01-03-2008, 03:49 PM
thankyou for replying, I have done what said and when I do a test in the recordset panel is says please provide a test value so I type in an artist_id like 12 and press test it works and shows all the albums that artist has produced, this is what I want.

So i created the recordset and when I inserted the album_description from the bindings panel onto the page and tested the page in my browser it is just blank where the album_description should be. This is what is confusing me?

01-07-2008, 03:35 AM
it is not picking up the value then . your first set is choosing by $_GET['album_id']. you have to supply a value for your second set to use artist name for example

01-07-2008, 09:54 AM
I have 2 recordsets on the page.
I have rs_Artist with a $_GET value of id_artist and and second recordset rs_Albums with a $_GET value of id_album.
Still can't get the rs_Albums to work.

01-08-2008, 12:22 AM
ok sorry i havent been concentrating much ( xmas cheer maybe!)
your first set is selected by url value
$_GET['album_id'your second
"SELECT * FROM artist, album WHERE album.album_id = artist.artist_id "; (shortened for clarity) but firstly does the artist have the same id in both tables?
iwould have thought by artist name would have been better
in any case i would have the 2nd record set select by $row_getAlbumDetails['artist_id'] which is the returned value by the first set.