PHP Classes

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Johnny

    #1

    PHP Classes

    Hi everybody,

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

    class adodb_connectio n
    {
    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_connectio n;
    //$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->Fieldszzzzzzzz zzzzzzzzzzzz=5; i get no error...! Shouldn't
    php come with an error stating that the variable Fieldszzzzzzzzz zzzzzzzzzzz
    isn't found??


    I hope that someone has the solution for me.

    Thanks in advance..!

    Johnny.



Working...