Below are the 20 most clicked-on Stockholm photos (excluding clicks from this page) over the last seven days. The percentages to the right are relative to the most popular photo.
DATE_SUB(now(), INTERVAL '7' DAY) AND clicks.photo=photo.ID AND photo.collection=collection.ID AND collection.place=place.ID AND place.region=region.ID GROUP BY clicks.photo ORDER BY 2 DESC LIMIT 0,20 ",$db);
$photo_position=0;
while ($photo_position <=19)
{
if ($photo_position==0)
{
$max_clickthrough=mysql_result($result_array_london,$photo_position,"sum(clicks)");
}
printf("");
$photonum=mysql_result($result_array_london,$photo_position,"clicks.photo");
$clickthrough_monitor=2;
include($DOCUMENT_ROOT . "/photo2.inc");
$sum_clicks=mysql_result($result_array_london,$photo_position,"sum(clicks)");
$sum_clicks_based=(($sum_clicks*100)/$max_clickthrough);
$rounded=round($sum_clicks_based);
$result_photo = mysql_query("SELECT * FROM photo,collection,place,region,country WHERE photo.collection=collection.ID AND collection.place=place.ID AND place.region=region.ID AND region.country=country.ID AND photo.ID='$photonum'",$db);
$photo_title=mysql_result($result_photo,0,"photo.title");
$collection_title=mysql_result($result_photo,0,"collection.title");
$place_title=mysql_result($result_photo,0,"place.title");
$region_title=mysql_result($result_photo,0,"region.title");
$country_title=mysql_result($result_photo,0,"country.title");
printf("%s %s %s %s %s%s%% |
",$photo_title,$collection_title,$place_title,$region_title,$country_title,$rounded);
$photo_position++;
}
?>