I have made a class in php which is goind to be inherited by another class in the other folder. when i put echo $this->protectedvariableofclass; //in subclass function it gives no value remember my base class is stored \class\user.php sublass is stored as \model\model_user.php Please help me out Thanks in advance
\ Class \ User.php baz Sınıf
<?php
class user
{
protected $user_id;
//setter method
public function set_user_id($user_id)
{
$this->user_id=$user_id;
}
//getter method
public function get_user_id()
{
return $this->user_id;
}
}
?>
\ Model \ model_user.php içinde Subclass
<?php
require_once 'class/user.php';
class model_user extends user
{
public function checkUser()
{
echo $this->user_id;
$sql = "SELECT * FROM user WHERE user_id='$this->user_id'";
$result = mysql_query($sql);
if(!result)
{
die('error'.mysql_error());
}
$duplicates = mysql_num_rows($result);
if($duplicates > 0)
return 1;
else
return 0;
}
}