query($query); $rows = mysqli_num_rows($result); $page_rows = 10; $last = ceil($rows/$page_rows); if ($page < 1) { $page = 1; } elseif ($page > $last) { $page = $last; } $start = ($page - 1) * $page_rows; $query .= ' LIMIT ' . $start . ',' .$page_rows; /* pagination stuff */ if ($last>1) { $page_nav = ""; } /* end of pagination stuff */ /* sort buttons */ $sort_b = '
'; $sort_b .= ''; $sort_b .= ''; $sort_b .= ''; $sort_b .= ''; $sort_b .= '
'; echo "

Photo Galleries

"; echo "
"; echo "

Posted in Images on Thursday 26th March 2015 at 7:57am"; echo "

\n"; echo "
\n"; /* end sort buttons */ $nav_bar = "
" . $page_nav . "
" . $sort_b . "
"; echo $nav_bar; if ($result = $link->query($query)) { while($row = mysqli_fetch_assoc($result)) { $phpdate = strtotime($row['gal_date']); $display_date = date( 'jS F Y', $phpdate ); $gal_dir = $row["gal_dir"]; $gal_img = $row["gal_title_img"]; if (! $gal_img) { $img_query="SELECT img_filename FROM picture WHERE gal_link=" . $row["gal_id"] . " LIMIT 1"; $img_result = $link->query($img_query); $img_row = mysqli_fetch_assoc($img_result); $gal_img = $img_row["img_filename"]; } $gal_comment = $row["gal_name"]; if (file_exists($gal_dir . "/normal_" . $gal_img)) { $src = "/albums/" . basename($gal_dir) . "/normal_" . $gal_img; } else { $src = "/albums/" . basename($gal_dir) . "/" . $gal_img; } echo ""; } $result->close(); unset($row); unset($query); } else { echo "

There's a problem...

"; echo "

I couldn't find anything to show you here. Perhaps you should start at the beginning?

"; } echo $nav_bar; ?>