<?php
require("include.php");

$found = array();

$query = "SELECT BookId FROM files GROUP BY `BookId` ORDER BY `BookId` DESC LIMIT 1";
$result = mysql_query_cached($query, 1);
$max = $result->data[0]['BookId'];
print_r($max . " total\n");

$query = "SELECT BookId FROM files GROUP BY `BookId`";
$result = mysql_query_cached($query, 1);

foreach($result->data as $row)
{
	$found[$row['BookId']] = true;
}

for($i = 1; $i <= $max; $i++)
{
	if(!isset($found[$i]))
	{
		echo("{$i} missing!\n");
	}
	else
	{
		//echo("{$i} isset.");
	}
}

echo("derp");

//print_r($found);
?>
