function pageBrowsing($table = "Listing", $screen = 1, $limit = false, $order = false, $letter_field = false, $letter = false, $where = false, $return_columns = "*", $return_object = false, $group_by = false) {
if (!is_numeric($screen) || ($screen <= 0)) $screen = 1;
if (!$screen) $screen = 1;
$db_mysqlversion = db_getDBObject();
$mysqlversion = mysql_get_server_info($db_mysqlversion->link_id);
$mysqlversion = substr($mysqlversion, 0, strpos($mysqlversion, "."));
/* Implementation for Mysql 3.23 ********************************/
if ($mysqlversion <= 3) {
$db = db_getDBObject();
$sql = "SELECT $return_columns FROM $table";
if ($letter && $where) {
if ($letter == "no") {
$sql .= " WHERE $letter_field REGEXP '^[^a-zA-Z].*$' AND $where";
} else {
if ($table == "Account") {
$sql .= " WHERE (($letter_field LIKE ".db_formatString($letter."%")." AND $letter_field NOT LIKE ".db_formatString("%::%").") OR $letter_field LIKE ".db_formatString("%::".$letter."%").") AND $where";
} else {
$sql .= " WHERE $letter_field LIKE ".db_formatString($letter."%")." AND $where";
}
}
} elseif ($letter) {
if ($letter == "no") {
$sql .= " WHERE $letter_field REGEXP '^[^a-zA-Z].*$'";
} else {
if ($table == "Account") {
$sql .= " WHERE (($letter_field LIKE ".db_formatString($letter."%")." AND $letter_field NOT LIKE ".db_formatString("%::%").") OR $letter_field LIKE ".db_formatString("%::".$letter."%").")";
} else {
$sql .= " WHERE $letter_field LIKE ".db_formatString($letter."%")."";
}
}
} elseif($where) {
$sql .= " WHERE $where";
}
if ($group_by) $sql .= " GROUP BY $group_by";
$record_amount = mysql_num_rows($db->query($sql));
}
/******************************************************************/
$this->letters = array("#","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z");
//$this->letters = array("Все","а","б","в","г","д","е","ж","з","и","к","л","м","н","о","п","р","с","т","у","ф","х","ц","ч","ш","щ","э","ю","я");
$this->table = $table;
$this->screen = $screen;
$this->limit = $limit;
$this->start = ($screen-1) * $limit;
$this->order = $order;
$this->group_by = $group_by;
$this->letter_field = $letter_field;
$this->letter = $letter;
$this->where = $where;
$this->return_columns = $return_columns;
$this->return_object = $return_object;
/* Implementation for Mysql 3.23 ********************************/
if ($mysqlversion <= 3) {
$this->record_amount = $record_amount;
$this->pages = ceil($record_amount/$limit);
$this->next_screen = ($screen >= ceil($record_amount/$limit)) ? ceil($record_amount/$limit) : ($screen+1);
$this->back_screen = ($screen <= 1) ? 1 : ($screen-1);
$this->page_jump = (ceil($record_amount/$limit) > 1000) ? 100 : 1;
}
/******************************************************************/
}