Jump to content

[SOLVED] Stupid parse error I cannot find


snowdog

Recommended Posts

Here is the error:

Parse error: parse error, unexpected $ in /home/httpd/vhosts/kingmenshockey.com/httpdocs/draft.php on line 510

 

line 510 is the last line of the code.  I have been searching for hours. I bet someone can find it in 2 minutes with fresh eyes. Thanks in advance, heres the code.

 

Snowdog

 

<?php

include("include/config.php");
include("include/skins/header.php");

if($action == "pick")
{
  // Determine which team is drafting now

  $link = mysql_connect($db_host, $db_username, $db_password) or die('Could not connect: ' . mysql_error());
  mysql_select_db($database) or die('Could not select database');
  $query = "SELECT * FROM draft WHERE draft_id = '1'";
  $result_draft = mysql_query($query) or die('Query failed: ' . mysql_error());
  $show_draft = mysql_fetch_object($result_draft);

  $draft_team = $show_draft->draft_team;
  $draft_order = $show_draft->order;

  if($draft_order == "up")
  {
    if($draft_team == "10")
    {
      $next_team = $draft_team;
    }
    else
    {
      $next_team = $draft_team + 1;
    }
  }
  if($draft_order == "down")
  {
    if($draft_team == "1")
    {
      $next_team = $draft_team;
    }
    else
    {
      $next_team = $draft_team - 1;
    }

  echo("<table border='0' width='825' cellpadding='10'>");
  echo("  <tr>");
  echo("    <td valign='top' colspan = 15>");
  //echo("	    <h3 align='center'>Welcome to the King City Men's Hockey League Draft</h3>");
  echo("	  <table border='0' cellspacing='0' cellpadding='5' width='100%'>");
  echo("        <tr>");
  echo("          <td width='20%' align='left'>");
  echo("            <big><b>Now Picking::</b></big>");
  echo("          </td>");
  // Display Team Logo and currently drafted players and Coundown timer
  echo("          <td width='60%' align='center' colspan = 15>");
  echo("            <span id='theTime' style='font-size: 34px; font-weight: bold;'></span>");
  echo("          </td>");
  echo("          <td width='20%' align='right'>");
  echo("            <big><b>Up Next:</b></big>");
  echo("          </td>");
  echo("        </tr>");
  echo("      </table>");
  echo("	  <table border='0' cellspacing='0' cellpadding='5' width='100%'>");
  echo("        <tr>");
  echo("          <td width='30%' colspan = 15 align='left'>");
  echo("            <img src='images/teams/".$draft_team.".gif' />");
  echo("          </td>");
  echo("          <td width='20%' colspan = 15 align='left' valign='top'>");
  echo("             <table width='100%'>");
  echo("               <tr>");
  echo("                 <td><b>A players</b></td>");
  echo("               </tr>");
                     // Get the players already drafted to the team picking
				 $query = "SELECT * FROM login WHERE team_name = '$draft_team' AND skill = 'a'";
			     $result_a = mysql_query($query) or die('Query failed: ' . mysql_error());
                     $num_rows = 3 - mysql_num_rows($result_a);                      
			     while($show_a = mysql_fetch_object($result_a))
                     {
  echo("               <tr>");
  echo("                 <td>$show_a->firstname $show_a->lastname</td>");
  echo("               </tr>");
                     }
                     if($num_rows < 3)
                     {
  echo("               <tr>");
  echo("                 <td><b>$num_rows A Picks Left</b></td>");
  echo("               </tr>");                     
                     }
  echo("               <tr>");
  echo("                 <td><b>Goalie Name:</td>");
  echo("               </tr>");                     
  echo("             </table>");
  echo("           </td>");
  echo("           <td width = '20%' valign='top'>");
  echo("             <table>");
  echo("               <tr>");
  echo("                 <td><b>B players</b></td>");
  echo("               </tr>");
                     // Get the players already drafted to the team picking
				 $query = "SELECT * FROM login WHERE team_name = '$draft_team' AND skill = 'b'";
			     $result_b = mysql_query($query) or die('Query failed: ' . mysql_error());
                     $num_rows = 3 - mysql_num_rows($result_b);                      
			     while($show_b = mysql_fetch_object($result_b))
                     {
  echo("               <tr>");
  echo("                 <td>$show_b->firstname $show_b->lastname</td>");
  echo("               </tr>");
                     }
                     if($num_rows != 0)
                     {
//                       $num_rows_left = 3 - $num_rows;
  echo("               <tr>");
  echo("                 <td><b>$num_rows B Picks Left</b></td>");
  echo("               </tr>");                     
                     }
                     // Get the goalie already drafted to the team picking
				 $query = "SELECT * FROM login WHERE team_name = '$draft_team' AND skill = 'g'";
			     $result_g = mysql_query($query) or die('Query failed: ' . mysql_error());
                     $num_rows = 1 - mysql_num_rows($result_g);                      
			     $show_g = mysql_fetch_object($result_g);            
                     if($num_rows == "1")
                     {
  echo("               <tr>");
  echo("                 <td align='left'><b>None Picked</b></td>");
  echo("               </tr>");
                     }
                     else
                     {         
  echo("               <tr>");
  echo("                 <td align='left'><b>$show_g->firstname $show_g->lastname</b></td>");
  echo("               </tr>");
                     }
  echo("             </table>");
  echo("           </td>");
  echo("           <td width='20%' valign='top'>");
  echo("             <table>");
  echo("               <tr>");
  echo("                 <td><b>C players</b></td>");
  echo("               </tr>");
                     // Get the players already drafted to the team picking
				 $query = "SELECT * FROM login WHERE team_name = '$draft_team' AND skill = 'c'";
			     $result_c = mysql_query($query) or die('Query failed: ' . mysql_error());
                     $num_rows = 4 - mysql_num_rows($result_c);                     
			     while($show_c = mysql_fetch_object($result_c))
                     {
  echo("               <tr>");
  echo("                 <td>$show_c->firstname $show_c->lastname</td>");
  echo("               </tr>");
                     }
                     if($num_rows != 0)
                     {
  echo("               <tr>");
  echo("                 <td><b>$num_rows C Picks Left</b></td>");
  echo("               </tr>");                     
                     }
  echo("             </table>");
  echo("          </td>");
  echo("          <td width='20%' colspan = 15 align='right'>");
  echo("            <img src='images/teams/".$next_team.".gif' />");
  echo("          </td>");
  echo("        </tr>");
  echo("      </table>");
  echo("	  <table border='0' cellspacing='0' cellpadding='5' width='100%'>");
  echo("        <tr>");

  // START A PLAYER LISTS

  echo("          <td align='center' width='33%' valign='top' colspan = 15>");
  echo("            <table border='0' align='center' cellpadding='2' cellspacing='0' width='100%'>");
  echo("	            <tr>");
  echo("                <th class='bottom' align=\"left\">Player Name</th>");
  echo("                <th class='bottom'>Goals</th>");
  echo("                <th class='bottom'>Assists</th>");
  echo("                <th class='bottom'>Tot. Pts</th>");
  echo("              </tr>");
  echo("              <tr>");
  echo("                <td colspan='4' align='center' valign='center' class=\"row-color\"><strong>A Players</strong></td>");
  echo("              </tr>");

                    // get the player info

                    $link = mysql_connect($db_host, $db_username, $db_password) or die('Could not connect: ' . mysql_error());
  	                mysql_select_db($database) or die('Could not select database');
                $query = "SELECT * FROM login WHERE skill = 'a' AND team_name < '99' AND draft_display = '1' ORDER BY lastname ASC";
                $result = mysql_query($query) or die('Query failed: ' . mysql_error());

                if ($result)
                {
	              $num = 1;
                  while($show = mysql_fetch_object($result))
                  {
                        $id = $show->id;
                    $firstname = $show->firstname;
                    $lastname = $show->lastname;

                        // Get las years stats from te archieves
		            $query = "SELECT * FROM archieved_stats WHERE player_id = '$id' ORDER BY season DESC";
                    $result2 = mysql_query($query) or die('Query failed: ' . mysql_error());

                        $show2 = mysql_fetch_object($result2);

                    $total_points = $show2->total_points;
                    $goals = $show2->goals;
                    $assists = $show2->assists;

	                if($num % 2 ==0)
                  	    {
  				  	      $col = "background-color:#eee";
				    }
                	    else
                	    {
			  	      $col = "background-color:#fff";
				    }
  echo("              <tr style=\"$col\">");
  echo("                <td align='left' class='bottom'>");
  echo("                  <a href='draft.php?action=insert&player_id=$id&draft_order=$draft_order&team_id=$draft_team'>$firstname $lastname</a>");
  echo("                </td>");
  echo("                <td align='center' class='bottom'>");
  echo("                  $goals");
  echo("                </td>");
  echo("                <td align='center' class='bottom'>");
  echo("                  $assists");
  echo("                </td>");
  echo("                <td align='center' class='bottom'>");
  echo("                  $total_points");
  echo("                </td>");
  echo("              </tr>");
                        $num++;
                      }
  	                }
  echo("            </table>");
  echo("            <table border='0' align='center' cellpadding='2' cellspacing='0' width='100%'>");
  echo("	          <tr>");
  echo("                <td width='100%' height='10'></td>");
  echo("              </tr>");
  echo("	          <tr>");
  echo("                <th class='bottom' align=\"center\">Goalie Name</th>");
  echo("                <th class='bottom'></th>");
  echo("                <th class='bottom'></th>");
  echo("                <th class='bottom'></th>");
  echo("              </tr>");
  echo("              <tr>");
  echo("                <td colspan='4' align='center' valign='center' class=\"row-color\"><strong>Goalies</strong></td>");
  echo("              </tr>");

                    // get the player info

                    $link = mysql_connect($db_host, $db_username, $db_password) or die('Could not connect: ' . mysql_error());
  	                mysql_select_db($database) or die('Could not select database');
                $query = "SELECT * FROM login WHERE skill = 'g' AND team_name < '99' AND draft_display = '1' ORDER BY lastname ASC";
                $result = mysql_query($query) or die('Query failed: ' . mysql_error());

                if ($result)
                {
	              $num = 1;
                  while($show = mysql_fetch_object($result))
                  {
                        $id = $show->id;
                    $firstname = $show->firstname;
                    $lastname = $show->lastname;

                        // Get las years stats from te archieves
		            $query = "SELECT * FROM archieved_stats WHERE player_id = '$id' ORDER BY season DESC";
                    $result2 = mysql_query($query) or die('Query failed: ' . mysql_error());

                        $show2 = mysql_fetch_object($result2);

                    $total_points = $show2->total_points;
                    $goals = $show2->goals;
                    $assists = $show2->assists;
	                if($num % 2 ==0)
                	    {
  				  	      $col = "background-color:#eee";
				    }
                	    else
                	    {
			  	      $col = "background-color:#fff";
				    }
  echo("              <tr style=\"$col\">");
  echo("                <td align='left' class='bottom'>");
  echo("                  $firstname $lastname");
  echo("                </td>");
  echo("                <td align='center' class='bottom'>");
  //echo("                  $goals");
  echo("                </td>");
  echo("                <td align='center' class='bottom'>");
  //echo("                  $assists");
  echo("                </td>");
  echo("                <td align='center' class='bottom'>");
  //echo("                  $total_points");
  echo("                </td>");
  echo("              </tr>");
                        $num++;
                      }
  	                }
  echo("            </table>");
  echo("          </td>");

  // START B PLAYER LISTS

  echo("          <td align='center' width='33%' valign='top' colspan = 15>");
  echo("            <table border='0' align='center' cellpadding='2' cellspacing='0' width='100%'>");
  echo("	            <tr>");
  echo("                <th class='bottom' align=\"left\">Player Name</th>");
  echo("                <th class='bottom'>Goals</th>");
  echo("                <th class='bottom'>Assists</th>");
  echo("                <th class='bottom'>Tot. Pts</th>");
  echo("              </tr>");
  echo("              <tr>");
  echo("                <td colspan='4' align='center' valign='center' class=\"row-color\"><strong>B Players</strong></td>");
  echo("              </tr>");

                    // get the player info

                    $link = mysql_connect($db_host, $db_username, $db_password) or die('Could not connect: ' . mysql_error());
  	                mysql_select_db($database) or die('Could not select database');
                $query = "SELECT * FROM login WHERE skill = 'b' AND team_name < '99' AND draft_display = '1' ORDER BY lastname ASC";
                $result = mysql_query($query) or die('Query failed: ' . mysql_error());

                if ($result)
                {
	              $num = 1;
                  while($show = mysql_fetch_object($result))
                  {
                        $id = $show->id;
                    $firstname = $show->firstname;
                    $lastname = $show->lastname;

                        // Get las years stats from te archieves
		            $query = "SELECT * FROM archieved_stats WHERE player_id = '$id' ORDER BY season DESC";
                    $result2 = mysql_query($query) or die('Query failed: ' . mysql_error());

                        $show2 = mysql_fetch_object($result2);

                    $total_points = $show2->total_points;
                    $goals = $show2->goals;
                    $assists = $show2->assists;
	                if($num % 2 ==0)
                	    {
  				  	      $col = "background-color:#eee";
				    }
                	    else
                	    {
			  	      $col = "background-color:#fff";
				    }
  echo("              <tr style=\"$col\">");
  echo("                <td align='left' class='bottom'>");
  echo("                  $firstname $lastname");
  echo("                </td>");
  echo("                <td align='center' class='bottom'>");
  echo("                  $goals");
  echo("                </td>");
  echo("                <td align='center' class='bottom'>");
  echo("                  $assists");
  echo("                </td>");
  echo("                <td align='center' class='bottom'>");
  echo("                  $total_points");
  echo("                </td>");
  echo("              </tr>");
                        $num++;
                      }
  	                }
  echo("            </table>");
  echo("          </td>");

  // START C PLAYER LISTS

  echo("          <td align='center' width='33%' valign='top' colspan = 15>");
  echo("            <table border='0' align='center' cellpadding='2' cellspacing='0' width='100%'>");
  echo("	            <tr>");
  echo("                <th class='bottom' align=\"left\">Player Name</th>");
  echo("                <th class='bottom'>Goals</th>");
  echo("                <th class='bottom'>Assists</th>");
  echo("                <th class='bottom'>Tot. Pts</th>");
  echo("              </tr>");
  echo("              <tr>");
  echo("                <td colspan='4' align='center' valign='center' class=\"row-color\"><strong>C Players</strong></td>");
  echo("              </tr>");

                    // get the player info

                    $link = mysql_connect($db_host, $db_username, $db_password) or die('Could not connect: ' . mysql_error());
   	                mysql_select_db($database) or die('Could not select database');
                $query = "SELECT * FROM login WHERE skill = 'c' AND team_name < '99' AND draft_display = '1' ORDER BY lastname ASC";
                $result = mysql_query($query) or die('Query failed: ' . mysql_error());

                if ($result)
                {
	              $num = 1;
                  while($show = mysql_fetch_object($result))
                  {
                        $id = $show->id;
                    $firstname = $show->firstname;
                    $lastname = $show->lastname;

                        // Get las years stats from te archieves
		            $query = "SELECT * FROM archieved_stats WHERE player_id = '$id' ORDER BY season DESC";
                    $result2 = mysql_query($query) or die('Query failed: ' . mysql_error());

                        $show2 = mysql_fetch_object($result2);

                    $total_points = $show2->total_points;
                    $goals = $show2->goals;
                    $assists = $show2->assists;

	                if($num % 2 ==0)
                  	    {
  				  	      $col = "background-color:#eee";
				    }
                	    else
                	    {
			  	      $col = "background-color:#fff";
				    }
  echo("              <tr style=\"$col\">");
  echo("                <td align='left' class='bottom'>");
  echo("                  $firstname $lastname");
  echo("                </td>");
  echo("                <td align='center' class='bottom'>");
  echo("                  $goals");
  echo("                </td>");
  echo("                <td align='center' class='bottom'>");
  echo("                  $assists");
  echo("                </td>");
  echo("                <td align='center' class='bottom'>");
  echo("                  $total_points");
  echo("                </td>");
  echo("              </tr>");
                        $num++;
                      }
  	                }
  echo("            </table>");
  echo("          </td>");
  echo("        </tr>");
  echo("      </table>");
  echo("    </td>");
  echo("  </tr>");
  echo("</table>");
}
elseif($action = "insert")
{
  // Insert player to the appropriate team

  $player_id = $_REQUEST['player_id'];
  $team_id = $_REQUEST['team_id'];
  $draft_order = $_REQUEST['draft_order'];
  $draft_team = $_REQUEST['team_id'];

  //echo $draft_team;

  $link = mysql_connect($db_host, $db_username, $db_password) or die('Could not connect: ' . mysql_error());
  mysql_select_db($database) or die('Could not select database');
  $query = "UPDATE login SET team_name = '$team_id' WHERE id = '$player_id'";
  $result = mysql_query($query) or die('Query failed: ' . mysql_error());

  // Have changed player to their newly drafted team now remove them from the draft

  $query = "UPDATE login SET draft_display = '0' WHERE id = '$player_id'";
  $result = mysql_query($query) or die('Query failed: ' . mysql_error());

  // Add player to the draft order database to display at a later time.
  $query = "INSERT INTO draft_list (draft_num,player_id,team_id) VALUES ('$draft_num','$player_id','$team_id')";
  $result = mysql_query($query) or die('Query failed: ' . mysql_error());

  

  // Determine the next team to draft and update the database

  // Update the draft team number
  if($draft_order == "up")
  {    
    $draft_team = $draft_team + 1;    
    if($draft_team == "11")
    {   
      $draft_team = "10";
      $draft_order = "down";
    

      $query = "UPDATE draft SET draft_team = '$draft_team', order2 = '$draft_order' WHERE draft_id = '1'";
      $result = mysql_query($query) or die('Query failed: ' . mysql_error());
    }
    else
    {
      $query = "UPDATE draft SET draft_team = '$draft_team' WHERE draft_id = '1'";
      $result = mysql_query($query) or die('Query failed: ' . mysql_error());
    }
  }
  else
  {
    $draft_team = $draft_team - 1;        
    if($draft_team == "0")
    {
      $draft_team = "1";
      $draft_order = "up";

      $query = "UPDATE draft SET draft_team = '$draft_team', order2 = '$draft_order' WHERE draft_id = '1'";
      $result = mysql_query($query) or die('Query failed: ' . mysql_error());
    }
    else
    {
      $query = "UPDATE draft SET draft_team = '$draft_team' WHERE draft_id = '1'";
      $result = mysql_query($query) or die('Query failed: ' . mysql_error());
    }

  }

  // Everything done, redirect back to the draft and start the draft clock

  header("Location: draft.php?action=pick");
}

include("include/skins/footer.php");

?>

Link to comment
https://forums.phpfreaks.com/topic/120646-solved-stupid-parse-error-i-cannot-find/
Share on other sites

That usually means that your "{ }" are unbalanced. Check them very carefully. Also check for any unclosed quotes.

 

You don't need to enclose the argument to the echo statement in parenthesis.

 

use

<?php
echo "xyz";
?>

 

instead of

<?php
echo ("xzy");
?>

 

 

Ken

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.