MySQL SUM() Returns an Empty Array Instead of Decimal Value – WordPress
I get an empty array when trying to get the sum of payments in decimal type column (4,2). Here's the code: global $wpdb; $balance = $wpdb->get_results("SELECT cast(sum(cpi) as decimal(5,2)) AS balance_value FROM hp_callbacks"); $row = mysqli_fetch_assoc($balance); $sum = $row['balance_value']; echo…