I am stuck part of this code.. I tried to call my static table variables but I can't.
Methinks I have very simple problem but.. effective and harmful for my project.
my class:
<?php
public $table;
class Functions
{
public function ehe()
{
return $table[4];
}
}
?>
my system.php file:
$fn = new Functions();
/* static tables */
$table = array(
0 => 'account.account',
1 => 'player.player',
2 => 'auction_house.items',
3 => 'auction_house.admin',
4 => 'auction_house.store',
5 => 'auction_house.styles',
6 => 'auction_house.logs',
7 => 'auction_house.coupons',
);
my index file(example): (connected with system.php & classes)
echo $fn->ehe;
my error:
Notice: Undefined property: Functions::$ehe in C:\Program Files (x86)\EasyPHP-DevServer-13.1VC9\.......php on line 178
A Little second question: Also I have 2 classes. 1: Functions class. (Include query processings etc.) 2: MySQL connect class. I want to connect this two classes for queries. How is this possible? ..
$tableis out of scope, as Mark said. Also you're accesing a property hereecho $fn->ehewhich is a variable inside that class. You have to callecho $fn->ehe()in order to access a method. Methods and functions always have to be called with their parentheses, even if they don't receive parameters (well, not "always"... there are exceptions likeecho, to mention one).