I'm building a plugin and I'm quite new to wordpress I have a class what has couple of methods what should execute database queries. The class look as it follows
class MyClass{
private $wpdb;
function __construct(){
global $wpdb;
}
function query(){
$wpdb->query( $wpdb->prepare("INSERT INTO $wpdb->wp_competitors
( id, field_key, field_value ) VALUES ( %d, %s, %s )",1,
$field_key, $field_value) );
}
}
I would like to be able to use inside of my class wordpress native database class, how to do this?