Object reference not set to an instance of an object error
Posted: August 16th, 2012, 12:36 pm
I am trying to run our web application on Phalanger and I didn't expect it work without some work but I have hit a snag I can't seem to pass. When I create a mysql connection and then try to save it in the class I get the error shown in the subject.
The error happens the instant I try and save the mysql connection into the class property.
Here are the 2 lines that I am using:
public function __construct() {
$conn = mysql_connect($host, $username, $password);
$this->_conn = $conn // Dies here with the error instantly.
}
I am using the mysql extension from your sister project. The connection itself works great - if I just try and use the connection to issue queries it gives back rows as expected. Try and save the connection in the public (or private) property $_conn and things go bad.
Thanks for any help.
The error happens the instant I try and save the mysql connection into the class property.
Here are the 2 lines that I am using:
public function __construct() {
$conn = mysql_connect($host, $username, $password);
$this->_conn = $conn // Dies here with the error instantly.
}
I am using the mysql extension from your sister project. The connection itself works great - if I just try and use the connection to issue queries it gives back rows as expected. Try and save the connection in the public (or private) property $_conn and things go bad.
Thanks for any help.