WordPress Shortcode with Select from table syntax error

What am i doing wrong i have a table called wp_pp_seller and there I have different columns, two of each are user_id and credits. Im trying to create a shortcoke on function.php file in a childtheme. My code is

    function custom_shortcode() {

    global $wpdb;

            $credits = $wpdb->get_results("SELECT {$credits} * FROM {$wp_pp_seller} WHERE user_id=current_user_id");        
            echo "<p>, {$credits} creditos</p>";


add_filter('init', 'add_custom_shortcode');

function add_custom_shortcode() {
   add_shortcode('pp_credits', 'custom_shortcode');

Source: shortcode

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.