[ "; $sql = "select count(*) from photos"; //query is a custom db connect function $total = query($sql); if (mysql_num_rows($total)==1) { $row = mysql_fetch_array($total); $total_images = $row[0]; $pages = ceil($total_images/$display_length); //calc the number of links to show (ceil rounds up to next int) for ($x = 1 ; $x <= $pages; $x++) { //don't show current page as link if ($base_offset == $offset) { echo "$x "; }else{ echo "$x "; }//end if $base_offset += $display_length; }//next }else{ echo "No other images found"; } echo "] |