Jochem,

Thank you for your advice. I was able to use your suggested code to develop the results I wanted.

I found I could simplify the "self" references down to just the name of the class.

The syntax I ended up with is

class database {
private static $database;
public static function getDB()
{
if (!isset($database))
$database = new database();
return $database;
}
private function __construct()
{
  $this->dbConnect();
}
private function dbConnect()
{
// Database connection
  return $result;
}
public function getData($type, $id)
{
// SQL Query
return $data;
}


And I call it like this:
$data = database::getDB()->getData($arg1, arg2);

Thank you for your time and advice.

--
Dave M G

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to