Beispiel #1
0
             }
         }
         $where_clause["( " . join(" OR ", $where_clause_filter) . " )"] = '';
     }
 }
 if ($FORM['where_data']) {
     $where_clause = $FORM['where_data'];
 }
 $records_per_page = !$records_per_page ? 18 : $records_per_page;
 $maximum_result_pages = 10;
 $FORM['start'] = ($FORM['start'] == "" or $FORM['start'] < 0) ? 0 : $FORM['start'];
 if (strval($FORM['start']) == "all") {
     $FORM['start'] = 0;
     $records_per_page = 1000000;
 }
 $total_records = mysql_count_query_records($mysql_connect_id, $table_name, $where_clause);
 $total_records = $total_records == "" ? 0 : $total_records;
 if (count($main_menu_fields_to_display)) {
     foreach ($main_menu_fields_to_display as $key => $value) {
         if (!preg_match("/\\(|\\)|\\s+as\\s+/i", $value)) {
             $main_menu_fields_to_display1[$key] = "`{$value}`";
         } else {
             $main_menu_fields_to_display1[$key] = $value;
             if (preg_match("/ as `?([\\w]+)`?/i", $value, $preg_results1)) {
                 $main_menu_fields_to_display[$key] = $preg_results1[1];
             }
         }
     }
     $main_menu_fields_to_display_string = join(", ", $main_menu_fields_to_display1);
     #$main_menu_fields_to_display_string = "`" . join( "`,`", $main_menu_fields_to_display ) . "`";
 }
$mysql_version = intval(mysql_version());
if ($mysql_version >= 4) {
    $time_start = microtime_float();
    $select_addons['FOUND_ROWS'] = '';
    $search_results = mysql_extract_records_where($mysql_connection_id, $table_to_query, $select_addons, $fields_to_extract);
    $total_records = mysql_select_total_records($mysql_connection_id);
    $time_end = microtime_float();
} else {
    $time_start = microtime_float();
    $search_results = mysql_extract_records_where($mysql_connection_id, $table_to_query, $select_addons, $fields_to_extract);
    if ($select_addons['LIMIT']) {
        //            $field_list = "";
        //            if ( $select_addons['LIMIT'] ) {
        //               $field_list =
        //            }
        $total_records = mysql_count_query_records($mysql_connection_id, $table_to_query, $select_addons);
    } else {
        $total_records = count($search_results);
    }
    $time_end = microtime_float();
}
$mysql_execute_time = $time_end - $time_start;
$total_records = $total_records == "" ? 0 : $total_records;
$starting = !$total_records ? 0 : $FORM['start'] + 1;
$ending = $FORM['start'] + $records_per_page;
$ending = $ending > $total_records ? $total_records : $ending;
$displaying = $ending - $starting + 1;
$total_pages = ceil($total_records / $records_per_page);
$current_page = ceil($starting / $records_per_page);
$total_pages = $total_pages ? $total_pages : 1;
$current_page = $current_page ? $current_page : 1;