Hey all!
Iv'e recently been playing about with OOP and im getting an error that doesn't make sense to me..
Notice: Undefined property: sql_connect in c:\program files\apache group\apache\htdocs\e.php on line 59
fuck up!
For reference..
class sql_connect
{
var $host;
var $user;
var $pass;
var $row = array();
var $dbname;
var $db_status;
var $query_result;
// constructor time..
function sql_connect($host, $user, $pass, $db)
{
$this->host = $host;
$this->user = $user;
$this->pass = $pass;
$this->dbname = $db;
$this->db_status = @mysql_connect($this->host, $this->user, $this->pass);
if($this->db_status)
{
$dbselect = @mysql_select_db($this->dbname);
if(!$dbselect)
{
@mysql_close($this->db_status);
$this->db_status = $dbselect;
}
}
else
{
$this->db_status = false;
}
return $this->db_status;
}
} // end class
$db = new sql_connect("localhost", "", "", "****");
if(!$db->sql_connect)
{
echo "fuck up!";
exit;
}
else
{
echo "Successfully connected to database.";
}
That's the code Iv'e written. The error said that the property sql_connect wasn't defined.. isn't that the sql_connect function definition?
Regards, Stezz.