ballhogjoni Posted August 11, 2008 Share Posted August 11, 2008 Don't know why this is happening. Can someone helpme figure this one out? The error is on line 12, here is the line of code: function Select($this->sTable="",$a_sData="",$sWhere="",$sGroupBy=""){ All my code: class FACSDatabase { function FACSDatabase($sTable=""){ $this->sTable = $sTable; } function Select($this->sTable="",$a_sData="",$sWhere="",$sGroupBy=""){ if( is_array( $a_sData ) ){ $a_sData = "" foreach( $a_sData as $data => $value ){ $a_sData .= $value; } $aResult = mysql_query("SELECT ".$a_sData." FROM ".$this->sTable." ".$sWhere." ".$sGroupBy); }else{ $aResult = mysql_query("SELECT ".$a_sData." FROM ".$this->sTable." ".$sWhere." ".$sGroupBy); } return $aResult; } } I am using PHP 5.2.6 Thanks Quote Link to comment Share on other sites More sharing options...
DarkWater Posted August 11, 2008 Share Posted August 11, 2008 You can't do that in a function header because $this->sTable is NOT being passed into the function. Try something like: function Select($sTable=null,$a_sData=null,$sWhere=null,$sGroupBy=null){ if (!$sTable) { $sTable = $this->sTable; } //rest of code } Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.