Connecting Tech Pros Worldwide Help | Site Map

PHP Classes

Johnny
Guest
 
Posts: n/a
#1: Aug 14 '08
Hi everybody,

I am trying to set up two classes in the following manner:

class adodb_connection
{
public function Execute($sSql)
{
//do something with $sSql here...
$this->Execute=new adodb_recordset;
$this->Execute->Fields=5;
}
}

class adodb_recordset
{
public $Fields;
}


When i am trying to get the Fields variable of adodb_recordset at the
following manner, i get a "Notice: Trying to get property of non-object in
..." error.

=>>>>

$connMain = new adodb_connection;
//$rstMain = new adodb_recordset;

$rstMain = $connMain->Execute('sql');
echo $rstMain->Fields;


1) Can someone tell me why this isn't working?
2) If i change $this->Execute->Fields=5; in function Execute to
$this->Execute->Fieldszzzzzzzzzzzzzzzzzzzz=5; i get no error...! Shouldn't
php come with an error stating that the variable Fieldszzzzzzzzzzzzzzzzzzzz
isn't found??


I hope that someone has the solution for me.

Thanks in advance..!

Johnny.



Closed Thread