$last) { $pagenum = $last; } //This sets range that we will display in our query $max = 'limit ' .($pagenum - 1) * $page_rows .',' .$page_rows; echo "
"; // THE PAGE MENUS // if ($pagenum == 1) { } else { echo " <<-First "; echo " "; $previous = $pagenum-1; echo " <-Previous "; } //just a spacer echo " ---- "; //This does the same as above, only checking if we are on the last page, and then generating the Next and Last links if ($pagenum == $last) { } else { $next = $pagenum+1; echo " Next -> "; echo " "; echo " Last ->> " } // END OF PAGE MENUS // echo "

"; //This is your query again, the same one... the only difference is we add $max into it $data_p = mysql_query("SELECT * FROM gallery WHERE active='1' $max") or die(mysql_error()); echo " -- Displaying Page $pagenum of $last --

"; //This is where you display your query results while($info = mysql_fetch_array( $data_p )) { ?>

"; // THE PAGE MENUS // if ($pagenum == 1) { } else { echo " <<-First "; echo " "; $previous = $pagenum-1; echo " <-Previous "; } //just a spacer echo " ---- "; //This does the same as above, only checking if we are on the last page, and then generating the Next and Last links if ($pagenum == $last) { } else { $next = $pagenum+1; echo " Next -> "; echo " "; echo " Last ->> "; } // END OF PAGE MENUS // echo "

"; include("bottom2.php"); ?>