diff --git a/select.inc.php b/select.inc.php index f9af8c98..b256697d 100644 --- a/select.inc.php +++ b/select.inc.php @@ -183,7 +183,6 @@ function add_row(field) { if (!$result->num_rows) { echo "

" . lang('No rows.') . "

\n"; } else { - $found_rows = (intval($limit) && $result->num_rows > $limit ? $mysql->result($mysql->query("SELECT COUNT(*) $from")) : $result->num_rows); $foreign_keys = array(); foreach (foreign_keys($_GET["select"]) as $foreign_key) { foreach ($foreign_key["source"] as $val) { @@ -237,7 +236,7 @@ function add_row(field) { echo "\n"; echo "

\n"; echo "\n"; - if (intval($limit) && $found_rows > $limit) { + if (intval($limit) && $result->num_rows >= $limit && ($found_rows = $mysql->result($mysql->query("SELECT COUNT(*) $from"))) > $limit) { $max_page = floor(($found_rows - 1) / $limit); function print_page($page) { echo " " . ($page == $_GET["page"] ? $page + 1 : '' . ($page + 1) . "");