<?
  if(empty($passwd)){
    print("<form action=show.php method=post>Password:
               <input type=password name=passwd><br>
        Pictures from <select name=y>
        <option>1999
        <option>1873
        </select><br>
        Artist is <select name=a>
        <option>Andyman<option>Blueman</select>
        </form>");
    exit();
  }

  $db = mysql_connect("localhost","root",$passwd);
  if(!mysql_select_db("advWebProg",$db)){
        print(mysql_error());
        exit();
  }
  $sel="select * from gallery where year=$y and artist='$a'";
  if($r=mysql_db_query("advWebProg",$sel,$db)){
      print("<h5>All Images in the Gallery table of advWebProg database</h5>");
      while($arr = mysql_fetch_row ($r)){
      $title=$arr[0];
      $artist=$arr[1];
      $year=$arr[2];
      $picture_name=$arr[3];
      print("<img src=img/$picture_name>
        <small><br>$title<br>By $artist<br>$year</small><hr>");
    
      }
   }else{
    print("<h1>query failed.");
   }

   mysql_free_result($r);
   mysql_close($db);
?>
<hr><a href=../php2txt.php?mysql_eg/show.php>Source</a>