I am trying to understand why i am getting the following error:
PHP Parse error: syntax error, unexpected T_VARIABLE, expecting T_FUNCTION in C:\Registration.class.php on line 43

var $team1;
    var $team2;
    var $team3;
    var $team4;
    var $team5;
    var $team6;
    var $team7;
    var $team8;
    var $team9;
    var $team10;
    var $team11;
    var $team12;
    var $team13;
    var $team14;
    var $team15;
    var $team16;
...
43: $teamMbrs= array($team1, $team2, $team3, $team4, $team5, $team6, $team7, $team8, $team9, $team10, $team11, $team12, $team13, $team14, $team15, $team16);

all of the variables being stored in the array are predefined.

I believe you have to do something like:

$teamMbrs= array(1 =>$team1, $team2, $team3, $team4, $team5, $team6, $team7, $team8, $team9, $team10, $team11, $team12, $team13, $team14, $team15, $team16);

the array looks right to me, I do know that the keyword "var" is used to declare variables in classes. This doesn't look like a class so delete those "var"s.

it is a class. I using daogen, http://www.titaniclinux.net/daogen/, generated source. The variables are pre-existing but I added the array to the class.

in that case you need a "var" in front of your array to declare it and you cannot declare variables with non-constant values without a constructor, also this process(declare variables with non-constant values) must be in a function.

so what you do is declare the array

var $teamMbrs= array();

then create a function, maybe like this

function assignTeamMbrs()
{
	$this->teamMbrs[] = $team1;
	$this->teamMbrs[] = $team2;
	$this->teamMbrs[] = $team3;
	$this->teamMbrs[] = $team4;
	$this->teamMbrs[] = $team5;
	$this->teamMbrs[] = $team6;
	$this->teamMbrs[] = $team7;
	$this->teamMbrs[] = $team8;
	$this->teamMbrs[] = $team9;
	$this->teamMbrs[] = $team10;
	$this->teamMbrs[] = $team11;
	$this->teamMbrs[] = $team12;
	$this->teamMbrs[] = $team13;
	$this->teamMbrs[] = $team14;
	$this->teamMbrs[] = $team15;
	$this->teamMbrs[] = $team16;
}

the call that function from the constructor like this

$this->assignTeamMbrs();
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.