This works perfectly fine:
$army = new Army();
$rq = $army->getRandomQuestion();
But this gives me all sorts of errors:
if (!isset($_SESSION['army'])){
$_SESSION['army'] = new Army();
}
$army = $_SESSION['army'];
$rq = $army->getRandomQuestion();
Errors:
Warning: mysqli::query() [mysqli.query]: Couldn't fetch mysqli in /home1/zimnoxco/public_html/ARLS/db_inc.php on line 95
Notice: Undefined variable: qid in /home1/zimnoxco/public_html/ARLS/db_inc.php on line 105
Warning: mysqli::query() [mysqli.query]: Couldn't fetch mysqli in /home1/zimnoxco/public_html/ARLS/db_inc.php on line 106
Fatal error: Call to a member function getQuestionID() on a non-object in /home1/zimnoxco/public_html/ARLS/index.php on line 83
I know the member functions in db_inc work as in my first example. But as soon as I try to use a session variable all hell breaks loose. I printed out the session variable using print_r and it appears correct.
"I like offending people, because I think people who get offended should be offended." - Linus Torvalds