<?
/*

 Don Smithers db
 Laget med PHP/MySQL
 
 (c) Ole J. Utnes, 2010.
 - show record
 */
?>

<? 
include 'header.inc';
require("config.inc.php");
require("functions.inc");

if (!$id) {
  echo "<br><b>No record ID given!</b>";
  include "footer.inc";  
  exit;
}

mysql_connect($hostname,$user,$pass);
mysql_select_db($dbname); 
$query = "select * from $album_table where id = '$id'";
$result = mysql_db_query($dbname, $query);
if ($result) {
   $num_rows = @mysql_num_rows($result);
   if ($num_rows < 1) {
     echo "<br><b class=h1>No record found!</b>";
     include "footer.inc";  
     exit;
   } 

 echo "<div class=small><a href=\"http://abel.hive.no/trumpet/smithers/db/\">[back]</a></div>";

 $row = mysql_fetch_array($result);
 echo "<table cellpadding=2 cellspacing=0 border=0>\n";
 echo "<tr>\n";
 echo "<td valign=top><span class=small>\n";  

 // get image if exist:
    $img_file = "image/ds_" .$id .".jpg";
    $img_file_b = "image/ds_" .$id ."_b.jpg";
    $big_img_file = "image/ds_" .$id ."_l.jpg";
    $big_img_file_b = "image/ds_" .$id ."_l_b.jpg";
    $no_img_file = "image/ds_0.jpg";
    if (file_exists($img_file)) {
      if (file_exists($big_img_file)) {
        echo "<a href=$big_img_file>"; 
        echo "<img src=\"$img_file\">";
        echo "</a>";
      } else {
        echo "<img src=\"$img_file\">"; 
      }
    } else {
      echo "<img src=\"$no_img_file\">";                                                                                    
    }  

    if (file_exists($img_file_b)) {
      echo "</td><td valign=top><span class=small>\n";  
      if (file_exists($big_img_file_b)) {
        echo "<a href=$big_img_file_b>"; 
        echo "<img src=\"$img_file_b\">";
        echo "</a>";
      } else {
        echo "<img src=\"$img_file_b\">"; 
      }
      echo "</td>\n";
    }

    echo "</td></tr>\n";
    echo "</table>\n";
   
    echo "<table border=0>\n";
    echo "<tr><td><span class=small>\n";

    echo "<br><br>";
    $titl = $row['title'];
    echo "<b>Record title: </b>";
    echo $titl ."<br>";
    
    $lbl_name="";
    $lbl_id = $row['label_id'];
    $sql = "SELECT name FROM $label_table where id ='$lbl_id'";
    $res = mysql_db_query($dbname,$sql);
    if ($res) {
      $rw = mysql_fetch_row($res);			   
      $lbl_name=$rw[0];
    }
    echo "<b>Record label: </b>";
    echo $lbl_name;
 
    $lbl_num = $row['label_number'];
    echo " / ";
    echo $lbl_num ."<br>";

    $medium = $row['medium'];
    if ($medium == '1') {
      $medium_txt = 'CD';
    } elseif ($medium == '2') {  
      $medium_txt = 'LP'; 
    } elseif ($medium == '3') {  
      $medium_txt = 'MC'; 
    } elseif ($medium == '4') {  
      $medium_txt = 'DVD'; 
    } else {
      $medium_txt = ''; 
    }
    echo "<b>Medium: </b>";
    echo $medium_txt ."<br>";

    $year = $row['year'];
    echo "<b>Year recorded: </b>";
    echo $year ."<br>";
    
    $perf = $row['performer'];
    $perf = html_filter_out($perf);
    echo "<br><b>Additional performer(s): </b><br>";
    echo $perf ."<br>";

    $cond = $row['conductor'];
    $cond = html_filter_out($cond);
    echo "<b>Conductor(s): </b><br>";
    echo $cond ."<br>";

    $orch = $row['orchestra'];
    $orch = html_filter_out($orch);
    echo "<b>Orchestra(s): </b><br>";
    echo $orch ."<br>";

    $comp = $row['composer'];
    $comp = html_filter_out($comp);
    echo "<b>Composer(s): </b><br>";
    echo $comp ."<br>";

    $tl = $row['track_listing'];
    $tl = html_filter_out($tl); 
    echo "<b>Track listing: </b>";
    echo "<br>" .$tl ."<br>";

    $comm = $row['comment'];
    $comm = html_filter_out($comm); 
    echo "<b>Comment: </b>";
    echo "<br>" .$comm ."<br>";

 echo "</td>"; 
 echo "</span></tr>\n"; 
 echo "</table>\n";

}
?>



<?
include 'footer.inc';
?>






