query($query);
if ($result)
{
$num = $result->num_rows;
if ($num == 0)
{ ?>
";
for ($i=0; $i < $num; $i++)
{
$row = $result->fetch_assoc();
echo "
PavThat Image #".$row['imageid']."
";
$id = $row['imageid'];
?>
MAX_WIDTH)
{
echo "
";
}
else
{
echo "
";
}
//echo "submitted on ".date("F jS \a\t g:ia", strtotime($row['time']))."
";
echo "".$row['description']."
";
echo "Pav Rating: ".round(($row['pavrating']*100),2)."%
";
}
echo "";
$query = "SELECT * FROM comments WHERE imageid='".$id."'";
$result = $db->query($query);
echo "";
}
}
}
else if (isset($_POST['lastvisited']))
{
$lastid = $_POST['lastvisited'];
$query = "SELECT * FROM images WHERE imageid!='".$lastid."' ORDER BY RAND() LIMIT 1";
$result = $db->query($query);
if ($result)
{
$num = $result->num_rows;
for ($i=0; $i < $num; $i++)
{
$row = $result->fetch_assoc();
$newid = $row['imageid'];
break;
}
echo "";
}
else
{
echo "Something went wrong...
";
}
}
else
{
$query = "SELECT * FROM images ORDER BY RAND() LIMIT 1";
$result = $db->query($query);
if ($result)
{
$num = $result->num_rows;
for ($i=0; $i < $num; $i++)
{
$row = $result->fetch_assoc();
$newid = $row['imageid'];
break;
}
echo "";
}
else
{
echo "Something went wrong...
";
}
}
$db->close();
include_once("footer.php");
?>