Wordpress oop wpdb in class
Try this...
<?phpclass MyClass {private $wpdb;public function __construct(){ global $wpdb; $this->wpdb = $wpdb;}public function table_results(){ $my_custom_table = $this->wpdb->prefix . "table_name"; $table_content = $this->wpdb->get_results("SELECT * FROM $my_custom_table"); return $table_content;}}