NYCPHP Meetup

NYPHP.org

[nycphp-talk] Help with a self:: ish problem

Rick Retzko rick at click-rick.net
Thu Dec 6 09:58:39 EST 2007


Gents/Ladies - 
 
Some help please with my PHP5 OOP learning curve:
 
I'm trying to use a $this variable to call a function within a class.  I
know the following works:
 
class actions {
 
 private $_aData;
 private $_table;
 
 public function __construct(){
    $this->_aData=array();
    $this->_table=FALSE;
 }
 
 private function update(){
  echo 'Update being executed!';
  return TRUE;
 }
 
//public functions ==================================
    public function do_action($table,$data){
     //direct action activity
     //assumption: $data['action'] will contain action definition
     $this->_table=$table;
     $this->_aData=$data;
     
     $completed=self::update();  //<==  THIS IS THE PROBLEM LINE
     
     return $completed;
     
    }
}
 
When I change that line to "$completed=self::$this->_aData['action'].'()';"
(which contains the string 'update'), the line is read, but nothing happens.
When I add "$action=$this->_aData['action'].'()';", then change the line to
"$completed=self::$action;", I get the following error message:
Fatal error: Access to undeclared static property: actions::$action in
C:\Program Files\Apache Software
Foundation\Apache2.2\htdocs\cjmea\hs_choir\classes\class.actions.php5 on
line 37.
 
All help is appreciated!


 
Best Regards - 
 
Rick
rick at click-rick.net
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nyphp.org/pipermail/talk/attachments/20071206/9906a8d2/attachment.html>


More information about the talk mailing list