Jump to content

[SOLVED] Parse error: syntax error, unexpected T_OBJECT_OPERATOR, expecting ')'


ballhogjoni

Recommended Posts

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

Link to comment
Share on other sites

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

}

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.