Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
I have a singleton pattern I am using, and when I declare it in the construct function I get errors when I use it in other functions in the class... example:Code: Select all
class Example {
public $example_error_message;
private $db;
/* Constructor */
public function __construct() {
/* DB Support Object */
$db = DB::Singleton();
/* Custom Errors Array */
$this->example_error_message = array();
}
public function ExampleView() {
$db->ExampleDBfunction();
}
}any suggestions as to why this is happening, I can fix the problem by re-assigning the $db object in each function, but I don't think I should have to do this.
Thank you in advance for any help you provide.
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]