hip1/po/bandinfo.php

<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title> </head> <div><a href='index.php'>Return to search</a></div> <body> <?php include('../db.php'); include('functions.php'); #Display band name $band_id = $_GET['band_id']; $query1 = "select * from bands where band_id = $band_id"; $result1 = mysqli_query($db, $query1) or die(mysqli_error($db)); $row1 = mysqli_fetch_array($result1); echo "<h1>$row1[name]</h1> <div>Formed in: $row1[found_year]</div>"; if($row1['disb_year']){ echo "<div>Disbanded in: $row1[disb_year]</div>"; } else{ echo "<div>Currently active</div>"; } #Display current band members $query2 = "select * from band_members bm, members m where band_id = $band_id and year_left is null and bm.member_id = m.member_id order by first_name, last_name, artist_name"; $result2 = mysqli_query($db, $query2) or die(mysqli_error($db)); echo "<h3>Current members:</h3>"; while($row2 = mysqli_fetch_array($result2)){ $fullname = nameDetermine($row2); echo "<h4><a href=memberinfo.php?member_id=$row2[member_id]>$fullname</a></h4>"; #Display band specific information on the member echo "<div>Year joined: "; if($row2['year_joined']){ echo $row2['year_joined']; } else{ echo "unknown"; } echo "</div> <div>Instruments: "; $textdisplay = ""; $query3 = "select * from instrument_bm ibm, instruments i where bandm_id = ".$row2['bandm_id']." and ibm.instrument_id = i.instrument_id order by i.instrument_id"; $result3 = mysqli_query($db, $query3) or die(mysqli_error($db)); while($row3 = mysqli_fetch_array($result3)){ $textdisplay = $textdisplay.$row3['instrument_name'].", "; } $textdisplay = substr_replace($textdisplay, "", strlen($textdisplay)-2, 2); echo "$textdisplay</div>"; } #Display past band members $query4 = "select * from band_members bm, members m where band_id = $band_id and year_left is not null and bm.member_id = m.member_id order by first_name, last_name, artist_name"; $result4 = mysqli_query($db, $query4) or die(mysqli_error($db)); echo "<h3>Past members:</h3>"; while($row4 = mysqli_fetch_array($result4)){ $fullname = nameDetermine($row4); echo "<h4><a href=memberinfo.php?member_id=$row4[member_id]>$fullname</a></h4>"; #Display band specific information on the member echo "<div>Year joined: "; if($row4['year_joined']){ echo $row4['year_joined']; } else{ echo "unknown"; } echo "</div> <div>Year left: $row4[year_left]</div> <div>Instruments: "; $textdisplay = ""; $query5 = "select * from instrument_bm ibm, instruments i where bandm_id = ".$row4['bandm_id']." and ibm.instrument_id = i.instrument_id order by i.instrument_id"; $result5 = mysqli_query($db, $query5) or die(mysqli_error($db)); while($row5 = mysqli_fetch_array($result5)){ $textdisplay = $textdisplay.$row5['instrument_name'].", "; } $textdisplay = substr_replace($textdisplay, "", strlen($textdisplay)-2, 2); echo "$textdisplay</div>"; } #Display up to 5 albums $query6 = "select * from albums where band_id = $band_id order by release_date DESC, album_id"; $result6 = mysqli_query($db, $query6) or die(mysqli_error($db)); echo "<h3>Albums: <p><a href=albums.php?band_id=$band_id>Show all</a></p></h3>"; $albumshow=0; while($row6 = mysqli_fetch_array($result6)){ $albumshow+=1; } if($albumshow>5){ $albumshow=5; } $result6 = mysqli_query($db, $query6) or die(mysqli_error($db)); for($i=0; $i<$albumshow; $i++){ $row6 = mysqli_fetch_array($result6); $date = convertdate($row6['release_date']); echo "<div><a href=albuminfo.php?album_id=$row6[album_id]>$row6[name]</a> ($date)<p>Type: $row6[type]</p></div>"; } $query7 = "select * from concerts c, concert_bands cb where band_id = $band_id and cb.concert_id = c.concert_id order by concert_date DESC, cb.concert_id"; $result7 = mysqli_query($db, $query7) or die(mysqli_error($db)); echo "<h3>Concerts: <p><a href=concerts.php?band_id=$band_id>Show all</a></p></h3>"; $concertshow=0; while($row7 = mysqli_fetch_array($result7)){ $concertshow+=1; } if($concertshow>3){ $concertshow=3; } $result7 = mysqli_query($db, $query7) or die(mysqli_error($db)); for($i=0; $i<$concertshow; $i++){ $row7 = mysqli_fetch_array($result7); $date = convertdate($row7['concert_date']); echo "<div><a href=concertinfo.php?concert_id=$row7[concert_id]>$row7[location]</a> ($date)</div>"; } ?> </body> </html>

Resultaat

Made by Thijs Aarnoudse