admin管理员组

文章数量:1313347

Thanks in advance could anyone here help me, I would like to display the value from the phpmyadmin database in wordpress, The value was stored from the dropdown form and I want display that value in the page, I have used the following code and it working fine, just want to display the sum of pledges from the columns.

Following is the code and I want to display the sum of the pledges value stored in the phpmyadmin, it's the dropdown value so please help me

<?php 

add_shortcode('displ_tb', function(){
global $wpdb;
$table_name = $wpdb->prefix_pl . 'wp_vxcf_leads_detail';
// this will get the data from your table
$dispdb_data = $wpdb->get_results( "SELECT * from $table_name" );
foreach ($dispdb_data as $dispdb_data){ 
    $pledge = $dispdb_data->value;
    $lead_id = $dispdb_data->lead_id;
}
    $output = '<div class="wrap">
                    <h2>Pledges.</h2>
                    <table>
                      <tr>
                        <th>Total Pledge</th>
                        <th>Live Count</th>
                      </tr> 
                      <tr>
                        <td>'. $pledge .'</td>
                        <td>'. $lead_id .'</td>
                      </tr>
                    </table>            
                </div>';
    return $output;
} );

?>

本文标签: phpHow to display data from custom table in wordpress phpmyadmin