I am having an issue calling an object's function. Can someone assist?
Error:
PHP Fatal error: Call to a member function add() on a non-object in C:\Properties.php on line 39
<?php
require_once 'HashTable.php';
/**
* Properties
*
* The following libraries should be load at instantiation
* dl("php_pdo.dll");
* dl("php_sqlite.dll");
*/
class Properties
{
private $hash;
private $dbHandle;
public function __construct($sqliteDB)
{
$hash= new HashTable();
$this->dbHandle = sqlite_open($sqliteDB, 0666, $sqliteerror) or die($sqliteerror);
$this->load();
}
function __destruct()
{
sqlite_close($this->dbHandle);
}
public function load()
{
if (!is_null($this->dbHandle)) {
$result = sqlite_array_query($this->dbHandle, 'select * from prop');
/*foreach ($result as $entry) {
var_dump($entry);
}*/
foreach ($result as $entry) {
echo "Adding... ";
echo $entry['key']." = ".$entry['value']."\n";
$this->hash->add($entry['key'], $entry['value']);
}
} else {
die("No active config file \n");
}
}
private function getHash()
{
return $this->hash;
}
public function get($key)
{
return $this->$hash->get($key);
}
}
?>
<?php
//add function from HashTable class
public function add($key= null, $value= null) {
if (!is_null($key) && !is_null($value)) {
$icomp= new IComparable($key, $value);
$this->addIComparable($icomp);
}
}
?>