used global $wpdb instead of local one