php - Wordpress Shortcode with Select from table syntax error -
i have table called wp_pp_seller
, , there have different columns, 2 of user_id
, credits
. i'm trying create shortcode in function.php
in child theme.
my code follows:
function custom_shortcode() { global $wpdb; $credits = $wpdb->get_results("select {$credits} * {$wp_pp_seller} user_id=current_user_id"); mysql_query($credits); echo "<p>, {$credits} creditos</p>"; } add_filter('init', 'add_custom_shortcode'); function add_custom_shortcode() { add_shortcode('pp_credits', 'custom_shortcode'); }
what doing wrong?
$current_user = wp_get_current_user(); $credits = $wpdb->get_results("select {$credits} * {$wp_pp_seller} user_id=" . $current_user->id)
Comments
Post a Comment