This code gives an error.
  <?php
    class DbOperation
    {
        private $con;
        function __construct()
        {
            require_once dirname(__FILE__) . '/DbConnect.php';
            $db = new DbConnect();
            $this->con = $db->connect();
        }
        function UyingaKirish($data){
            function Tekshir($ki1){
                $stmt2=$this->con->prepare("SELECT HowManyPlayers FROM groups WHERE NumberOfGroup=?"); //error is here
                $stmt2->bind_param("i",$ki1);
                $stmt2->execute();
                $stmt2->store_result();
                return $ki1;
            }
$u=Tekshir(5);
    }
But when I use like this it works fine
class DbOperation
    {
        private $con;
        function __construct()
        {
            require_once dirname(__FILE__) . '/DbConnect.php';
            $db = new DbConnect();
            $this->con = $db->connect();
        }
        function UyingaKirish($data){
   $u=5;
                $stmt2=$this->con->prepare("SELECT HowManyPlayers FROM groups WHERE NumberOfGroup=?");
                $stmt2->bind_param("i",$u);
                $stmt2->execute();
                $stmt2->store_result();
    }
So the whole error is
Fatal error Using $this when not in object context in
How can use it inside the function?
