I have a model class that looks likes the following
function block_user()
{
function is_in_blocked_list()
{
//line number 137...
}
function power_block()
{
is_in_blocked_list() // doing some operations
}
if (condition)
{
power_block();
}
}
But i am getting an error on is_in_blocked_list()
that is
Using $this when not in object context in C:\wamp\www\pname\application\models\admin\admin_user.php on line 137
Line 137 says that
$qry = "SELECT a FROM tblC WHERE username=?";
$qry = $this->db->query($qry,array($userName));
i am new to php and codeigniter,how can i fix this problem ?
INFO :THANKS FOR THE DOWNVOTE [BUT YOUR ANSWER IS WORST :)]
Your functions need to ask on what they operate:
Replace the
Controllertype with the type of controller they should operate on, the general one in CI is calledCI_ControllerIIRC.I would not consider this a good solution, but it probably shows the picture what you’re conceptually doing.