<?
include '/home/mmaaaco/public_html/wdm3304materials/wdm3304week1/dbconnect.php';
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Untitled Document</title>
</head>
<body>
<div id = "wrapper">

<?
//show categories in dropdown
$sql = $dbh->prepare("select * from 3304gallcats");
$sql->execute();
while ($carolyn  = $sql->fetch()){
	 echo '<a href = "index.php?catid='.$carolyn['catid'].'">'.$carolyn['catname'].'</a><br/>'."\n";
}

$catid = $_GET['catid'];
$picsql = $dbh->prepare("select * from 3304gallpix where catid = '$catid'");
$picsql->execute();
while ($maruja  = $picsql->fetch()){
	 $pic = $maruja['id'].'.jpg' ;
	 echo '<img src = "thumbnail.php?pic=images/'.$pic.'&ht=50&wd=50"/><br/>'.$maruja['pictitle'].'<br/>'.$maruja['picdesc']."\n";
}


?>
</div>
</body>
</html>
