I am using a wordpress plugin called TABLEMASTER to show tables in a post or a page. In this link link You can see that I have a result of a select that I made and it is as follows:
[tablemaster sql="SELECT AP, T, CA, H, 2H, 3H, HR, CE, BB, P, BR, SF, TB, AVE, OBP, SLG, OPS from stats WHERE id = 11"]
MY INTEREST IS THAT I DO NOT SHOW THE FIELDS THAT ARE INSIDE THE SELECT TO BE ABLE TO ELIMINATE THE SECOND SELECT THAT IS SEEN IN THE IMAGE.
UPDATING: This is the code in the plugin to show the columns
/*
* Get the column names from the query results.
*/
$query_columns = array();
$num_query_columns = mysql_num_fields($result);
for( $i=0;$i<$num_query_columns;$i++) {
array_push($query_columns, mysql_field_name($result, $i) );
}
// This is the column names as a result of the query. It could be the names of the columns, or custom names for the columns. If link labels are used, it needs to contain both the link labels and link targets columns.
// it is recommeded that the columns keyword be used if link labels are link targets are used so that you can control whether the link target column is printed.
// The column names specified in the columns array must match the column names in the query results.
/*
* Get the list of columns that should be printed.
*/
$print_columns = array();
if ( isset( $this->tables[$table_id]['settings']['columns'] )) {
$print_columns = explode(',', $this->tables[$table_id]['settings']['columns'] );
} else {
$print_columns = $query_columns;
}
/*
* Get the list of columns that should not wrap
*/
$nowrap_columns = array();
if ( isset( $this->tables[$table_id]['settings']['nowrap'] )) {
$nowrap_columns = explode(',', $this->tables[$table_id]['settings']['nowrap'] );
}
/*
* Get the list of column widths.
*/
$column_widths = array();
if ( isset( $this->tables[$table_id]['settings']['col_widths'] )) {
$column_widths = explode(',', $this->tables[$table_id]['settings']['col_widths']);
}