Jump to content

Parse error, need help


cenarius

Recommended Posts

parse error, unexpected '[' on line 81

 

I am desperate and I hope you guys help me out. I'm quite new to php.

 

This is full code.

 

<html>
<body text="FFCC00" bgcolor="black" link="red" vlink="yellow">

<div align="center"><img src="dotaladder.jpg"></div>
<br>
<div align="center"><a href="http://warsong.team-forum.net/">Clan Forum</a></div>
  <br>
  <br>
  <div align="center">This are dota stats from all dota games hosted with cen1 bot (hosted by Marcotjuhhhhh).<br>
The Overall scores are made by this formula: Kills-Deaths+Assists</div>
  <br>
  <br>

<?php

//-----Member's list-----

$whilenum1 = 0;
$whilenum2 = 0;
$whilenum3 = 1;
$whilenum4 = 0;
$sumup = 1;

$name[1] = "cen";
$name[2] = "enigma77";
$name[3] = "Nefarel";
$name[4] = "[si]X_Shrak";
$name[5] = "Edge.";
$name[6] = "Heolix";
$name[7] = "The][King";
$name[8] = "-bling-";
$name[9] = "CORS0";
$name[10] = "eleven0seven";
$name[11] = "Dota_Man";
$name[12] = "Pr3dator";
$name[13] = "[Wsc]Za_Mih9_Ok";
$name[14] = "strganec";
$name[15] = "Monsoon";
$name[16] = "Bizkit";
$name[17] = "[sI]_HuDoBn_";
$name[18] = "spyker_007";
$name[19] = "]k[";
$name[20] = "anusminimus";
$name[21] = "ViRTuazZzZ";
$name[22] = "Sharon";

//-----------Connect+Select---------------------

$con = mysql_connect("localhost","root","");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("wc3_ghost_database", $con);

//----------------Get the clan members IDs and store them in arrayed variables--------------------

while ($whilenum1 < 23)
{
$whilenum1++;
$return1 = mysql_query("SELECT * FROM gameplayers WHERE name='$name[$whilenum1]'"); //selecting all rows with the same name
$num_rows[$whilenum1] = mysql_num_rows($return1); //storing number of rows, array is the same as player's array

while ($row1 = mysql_fetch_array($return1))
{
$whilenum2++;
$playerid[$whilenum2] = $row1['id']; //storing the IDs of the selected names into arrayed variable
}
}

//-------------------Get the player's id, store it's stats into a variable and sum them up------------------------------


while ($whilenum3 <= $num_rows[$sumup]) //this condition is for checking if we are still working with the IDs that belong to the same name
{
$connect = mysql_query("SELECT * FROM dotaplayers WHERE id='$playerid[$whilenum3]'"); //player id arrays up each loop

$row2 = (mysql_fetch_array($connect));

$kills[$sumup] = $kills[$sumup] + row2['kills']; //stats need to manitain the same array until we reach our number of rows per user
$deaths[$sumup] = $deaths[$sumup] + row2['deaths'];
$assists[$sumup] = $assists[$sumup] + row2['assists'];
$creepkills[$sumup] = $creepkills[$sumup] + row2['creepkills'];
$creepdenies[$sumup] = $creepdenies[$sumup] + row2['creepdenies'];

$whilenum3++;  

if ($whilenum3 > $num_rows[$sumup]) //when $whilenum3 becomes bigger then our rows, we started to work with another player so we increase the $sumup so it will store that player's stats in another array. This will cause the same player to have it's stats in the same array
{
$sumup++;
}
}

//------We have all the stats stored now (hopefully) and we are ready to set the overall scores and display everything------

while ($whilenum4 < 23)
{
$whilenum4++;
$overall[$whilenum4] = $kills[$whilenum4] - $deaths[$whilenum4] + $assists[$whilenum4];
}

//--------Sort by overall + insert in table----------------------


mysql_close($con);
?> 


</body>
</html>

Link to comment
Share on other sites

I'm quite new to php.

 

Actually it would be better if you tried to correct the error yourself you will learn much more then when we just tell you what the problem is.

 

$kills[$sumup] = $kills[$sumup] + row2['kills']; //stats need to manitain the same array until we reach our number of rows per user
$deaths[$sumup] = $deaths[$sumup] + row2['deaths'];
$assists[$sumup] = $assists[$sumup] + row2['assists'];
$creepkills[$sumup] = $creepkills[$sumup] + row2['creepkills'];
$creepdenies[$sumup] = $creepdenies[$sumup] + row2['creepdenies'];

 

Needs to be:

 

$kills[$sumup] = $kills[$sumup] + $row2['kills']; //stats need to manitain the same array until we reach our number of rows per user
$deaths[$sumup] = $deaths[$sumup] + $row2['deaths'];
$assists[$sumup] = $assists[$sumup] + $row2['assists'];
$creepkills[$sumup] = $creepkills[$sumup] + $row2['creepkills'];
$creepdenies[$sumup] = $creepdenies[$sumup] + $row2['creepdenies'];

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.