0
jessica posted
how to acess the property of object in PHP ?
how to acess the property of object in PHP ?
class Customers_List {
/** Class constructor */
public $tablename='';
public function __construct($tablename='') {
$this->tablename=$tablename;
}
public static function get_customers( $per_page = 5, $page_number = 1 ) {
$sql = "SELECT * FROM {$wpdb->prefix}".$this->tablename;
}
}
class for customers , its accessing the $tablename property in another function of the class .
so its give me error like this
Fatal error: Using $this when not in object context in