Find An Image // postimage.php - by Joseph Sottnik // code that will be executed if the form has been submitted: ConnectDB();$pref = array(); //mysql_connect("localhost", "sottnik", "lock343"); //mysql_select_db("sottnik"); if($direct_link) { $pref[0] = $direct_link;} if($sel_name) { $pref[0]=$sel_name;} if($photo_no) {// code that gets executed if a specific image is requested print "";} else { // code that gets executed for a keyword search $prefsize = sizeof($pref); // print "prefsize=$prefsize"; // print ", $pref[0]"; $asciistart=ord("a"); if($prefsize > 0) { $preflimit = 10; if($prefsize > $preflimit) { $prefsize = $preflimit; // limit search to $preflimit keywords print "

Your search was limited to $preflimit keywords to prevent overloading the search computer."; } print "

The following photos match your request:

"; $query="SELECT Title, Photograph.PhotoID, FileSize, ThumbNail, PhotoDate FROM Photograph"; for($i = 0; $i < $prefsize; $i++) { $query .= ",PhotoKey ".chr($asciistart + $i); } $query.=" WHERE ((Photograph.PhotoID=a.PhotoID)"; for($i=1;$i<$prefsize;$i++) { $temp=chr($asciistart+$i); $query.=" AND (Photograph.PhotoID=$temp.PhotoID)"; } for($i=0; $i<$prefsize; $i++) { $temp=chr($asciistart+$i); $query.=" AND ($temp.KeywordID=$pref[$i])"; } $query.=")"; print "
$query"; $result=mysql_query($query); print mysql_error(); ?> "; $photo=mysql_fetch_row($result); print ""; } print "
ThumbNailTitleIDSize
"; //thumbnail print "$photo[0]"; print "$photo[1]"; print "$photo[2]"; print "
"; print "

Click on a Photo ID to see the full photo

"; sort($pref); $keyin = "("; for($i=0;$i<$prefsize;$i++) { if($i>0) $keyin = $keyin.","; $keyin = $keyin.$pref[$i]; } $keyin=$keyin.")"; $query="SELECT PhotoID,KeywordID FROM PhotoKey WHERE KeywordID IN $keyin"; // print "query is $query";// $result=mysql_query($query); // for($i=0;$i";// $test=mysql_fetch_row($result);// print "$test[0]";// print "$test[1]";// print "";// }// print ""; } else { print "

No keywords selected"; }} print "

This page last revised July 1, 2010.

"; include("copyright.txt"); ?>