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 "\"image"; } else { echo "\"image"; } //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 "
"; echo "

Comments:

"; ?>
fetch_assoc()) { $results[] = $temp; } $results = array_reverse($results); $i=0; if (count($results) == 0) { echo "
No comments...
"; } else { echo "
"; foreach ($results as $row) { echo "".$row['author']." says:"; echo "Posted on ".date("F jS \a\\t g:ia", strtotime($row['time'])).""; $comment = str_ireplace("/pav", "/pav", $row['comment']); if ($i%2 == 0) echo "

"; else echo "

"; echo preg_replace("(\n\n|\n)", "
", $comment); echo "

"; $i++; } echo "
"; } } 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"); ?>