I am trying to understand how classes and functions work more.
So i have written a class with 2 functions inside it. Then initiated the class with
$fifaadmin = new FifaAdmin;
When I try to call this class from another page i get the following error
Call to a member function leagueToReplace() on a non-object
What am i doing wrong? Is there an obvious answer?
Thanks
Sounds like
$fifaadmindidn’t instantiate the object correctly.What does this say?
It should return
trueif it is set up correctly. Try it just before you call a method on it.When you say another page, do you mean from a PHP include or a new URL (and therefore request)?
You will need to instantiate it on every request, as HTTP is stateless.