Inheritance

1 view
Skip to first unread message

Sanam Shrestha

unread,
Mar 8, 2013, 6:11:42 AM3/8/13
to phpgroup2...@googlegroups.com
How to use protected variable in child class?? ::
<?php

class Database {
    protected $_mysql;
    public $query ='hello';

?>

<?php
class User extends Database {
    private $user_id;
   
    public static function userAuthenticate($id, $password){
        print_r($this->query);

}
?>
as result i get following error:
Fatal error: Using $this when not in object context in C:\xampp\htdocs\projects\design_her\classes\user.Class.inc on line 6.
Reply all
Reply to author
Forward
0 new messages