Retrieve column metadata from the last query.
public get_col_info ( string $info_type = 'name', integer $col_offset ) : mixed | ||
$info_type | string | Optional. Type one of name, table, def, max_length, not_null, primary_key, multiple_key, unique_key, numeric, blob, type, unsigned, zerofill |
$col_offset | integer | Optional. 0: col name. 1: which table the col's in. 2: col's max length. 3: if the col is numeric. 4: col's type |
Результат | mixed | Column Results |
} else { //Page navigation $pagination = new pagination(); $pagination->set_pagination_tpl_path($wpbi_url['tpl']); $pagination->set_pg_interval($wpbi_settings['parameter']['page-interval']); $pagination->set_pg_parameter('paged'); $pagination->set_current_page(isset($_GET[$pagination->pg_parameter]) ? abs((int) $_GET[$pagination->pg_parameter]) : 1); $pagination->set_rows($total_rows); $pagination->set_css_class('widefat'); $pagination->set_pagination_stats($wpbi_dialog['table']['pagination']['stats']); $pagination->set_paginate_links(paginate_links(array('base' => esc_url(add_query_arg($pagination->pg_parameter, '%#%')), 'format' => '', 'prev_text' => $wpbi_dialog['table']['pagination']['prev_text'], 'next_text' => $wpbi_dialog['table']['pagination']['next_text'], 'total' => ceil($pagination->rows / $pagination->pg_interval), 'current' => $pagination->current_page))); $pagination->initialize(); //END page navigation //Execute query limitng the resultset $my_test_rows = $my_test_db->get_results($query->limit_qy_to($pagination->item_start - 1, $pagination->pg_interval), 'ARRAY_N'); $my_test_cols = $my_test_db->get_col_info('name'); //Output table $table = new table(); $table->set_table_tpl_path($wpbi_url['tpl']); $table->set_table_pagination($pagination->get_html()); $table->set_css_class('widefat'); $table->set_rows($my_test_rows); $table->set_cols($my_test_cols); $table->has_header(true); $table->has_footer(true); $table->encode_html(true); $test_output = $test_output . $table->get_html(); } //Prepare output $template_site->assign_vars(array('PG_TITLE' => $wpbi_dialog['page']['queries']['title'], 'PG_DESCRIPTION' => sprintf($wpbi_dialog['query']['saved']['test'], $vo_query->name, htmlentities($query->stmt)))); $template_site->pparse('header');