How to display data from custom table in wordpress phpmyadmin


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


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">
                        <th>Total Pledge</th>
                        <th>Live Count</th>
                        <td>'. $pledge .'</td>
                        <td>'. $lead_id .'</td>
    return $output;
} );


In this following image I want to display the sum of the pledge each time user add the pledge it should increse

Siddheshwar Chavan 8 months 2020-12-02T09:10:58-05:00 0 Answers 8 views 0

Leave an answer