user1266343
user1266343

Reputation: 177

Whats the root cause for "Parse error: syntax error, unexpected T_STRING, expecting T_VARIABLE"?

I have the below method, but when ever i run the application I am getting following error:
"Parse error: syntax error, unexpected T_STRING, expecting T_VARIABLE"

 public static getExcludedEmailCount($email){
    db_set_active(TEST_DB);
    $sql = "select COUNT(*) from person WHERE SUBSTRING_INDEX('%s','@',1) IN (SELECT email_role FROM email_role_exclusion)";

    $result = db_query($sql, $email);

    db_set_active();
    return $result;
}


Does anyone know whats the cause, I am quite new to Drupal and PHP. Thanks a lot in advance.

Upvotes: 0

Views: 879

Answers (1)

Iqbal Malik
Iqbal Malik

Reputation: 602

You forgot to put function. Declare like this

public static function getExcludedEmailCount($email)

Also the method inside getExcludedEmailCount belongs to the same class then use $this keyword, if they are belongs to another class, make object of that class and then access these methods.

Upvotes: 2

Related Questions