| $pos = strpos($_COOKIE["view"],"gallery"); if ($pos === false) {
if ($rating == "") {
echo "
    " ;
}    else {
    $mysql= mysql_connect("localhost","qtl","qtqtqt;;")  or die("could not connect to mysql");
    $result=mysql_db_query("photo", "select ratings_nb,ratings_av  from image_stats where ref = 'camb2936-bw'")
    or die ("query failed = " . mysql_errno() . ": " . mysql_error());
    if (mysql_num_rows($result) > 0) {
	$array = mysql_fetch_row($result);
	$nb = $array[0];
	$av = $array[1];
    }
    if ($nb == 1) {
	echo "You were the first to rate this image. Thanks !";
    } else {
	printf( "This image has been rated $nb times with an average of %.1f/10",$av);
    }
    mysql_close($mysql);
}
if ($ref_prev != "") {
   $mysql= mysql_connect("localhost","qtl","qtqtqt;;")  or die("could not connect to mysql");
    $result=mysql_db_query("photo", "select ratings_nb,ratings_av  from image_stats where ref = '$ref_prev'")
    or die ("query failed = " . mysql_errno() . ": " . mysql_error());
    if (mysql_num_rows($result) > 0) {
	$array = mysql_fetch_row($result);
	$nb = $array[0];
	$av = $array[1];
    }
    if ($nb == 1) {
	echo " 
 You were the first to rate the previous image $ref_prev. Thanks !";
    } else {
	printf( "
 
 Thanks for your rating. Previous image $ref_prev has been rated $nb times with an average of %.1f/10",$av);
    }
    mysql_close($mysql);
   echo "
 ";
}
}
?>
 |  Angkor Wat     |