Solved

Parse error: parse error, unexpected $ in...

Posted on 2007-04-10
7
238 Views
Last Modified: 2007-04-10
Can't figure this one out, I've been looking at this for 2 hours.

http://www.austinmetrobaseball.com/gamechange.txt
0
Comment
Question by:EddieShipman
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 24

Expert Comment

by:glcummins
ID: 18885131
Can you post the full error message? All we received was "parse error, unexpected $ in..."
0
 
LVL 29

Accepted Solution

by:
TeRReF earned 500 total points
ID: 18885180
Change these lines:

  if ( isset($_POST["gameid_1"]) ) {
    $sql = "SELECT h.email AS hemail, v.email AS vemail ";
    $sql = $sql. "FROM games AS g ";
    $sql = $sql. "JOIN teams AS v ON ( v.id = g.visitorid ) ";
    $sql = $sql. "JOIN teams AS h ON ( h.id = g.homeid ) ";
    $sql = $sql. "WHERE g.gamenum = ".$_POST["gameid_1"];
    $query = $db->query($sql);
    if ($db->num_rows($query) > 0) {
      list($hemail1, $vemail1)=$db->fetch_row($query);
    }
    $sql = "SELECT gamenum, ";
    $sql = $sql. "       DATE_FORMAT(gamedate, \"%a %b %d  %l:%i%p\"), ";
    $sql = $sql. "       v.teamname AS visitor, ";
    $sql = $sql. "       h.teamname AS home, ";
    $sql = $sql. "       f.field_name ";
    $sql = $sql. "FROM games AS g ";
    $sql = $sql. "JOIN teams AS v ON ( v.id = g.visitorid ) ";
    $sql = $sql. "JOIN teams AS h ON ( h.id = g.homeid ) ";
    $sql = $sql. "JOIN _fields AS f ON (f.id = g.fieldid )";
    $sql = $sql. "WHERE g.gamenum =".$game_num1;
    $query = $db->query($sql);
    if ($db->num_rows($query) > 0) {
      list($gamenum1, $gamedate1, $visitteam1, $hometeam1, $field_name1)=$db->fetch_row($query);
  }
  if ( isset($_POST["gameid_2"]) ) {
    $sql =  "SELECT h.email AS hemail, v.email AS vemail ";
    $sql = $sql. "FROM games AS g ";
    $sql = $sql. "JOIN teams AS v ON ( v.id = g.visitorid ) ";
    $sql = $sql. "JOIN teams AS h ON ( h.id = g.homeid ) ";
    $sql = $sql. "WHERE g.gamenum = ".$_POST["gameid_2"];
    $query = $db->query($sql);
    if ($db->num_rows($query) > 0) {
      list($hemail2, $vemail2)=$db->fetch_row($query);
    }
    $sql = "SELECT gamenum, ";
    $sql = $sql. "       DATE_FORMAT(gamedate, \"%a %b %d  %l:%i%p\"), ";
    $sql = $sql. "       v.teamname AS visitor, ";
    $sql = $sql. "       h.teamname AS home, ";
    $sql = $sql. "       f.field_name ";
    $sql = $sql. "FROM games AS g ";
    $sql = $sql. "JOIN teams AS v ON ( v.id = g.visitorid ) ";
    $sql = $sql. "JOIN teams AS h ON ( h.id = g.homeid ) ";
    $sql = $sql. "JOIN _fields AS f ON (f.id = g.fieldid )";
    $sql = $sql. "WHERE g.gamenum =".$game_num2;
    $query = $db->query($sql);
    if ($db->num_rows($query) > 0) {
      list($gamenum2, $gamedate2, $visitteam2, $hometeam2, $field_name2)=$db->fetch_row($query);
    }



into:

  if ( isset($_POST["gameid_1"]) ) {
    $sql = "SELECT h.email AS hemail, v.email AS vemail ";
    $sql = $sql. "FROM games AS g ";
    $sql = $sql. "JOIN teams AS v ON ( v.id = g.visitorid ) ";
    $sql = $sql. "JOIN teams AS h ON ( h.id = g.homeid ) ";
    $sql = $sql. "WHERE g.gamenum = ".$_POST["gameid_1"];
    $query = $db->query($sql);
    if ($db->num_rows($query) > 0) {
      list($hemail1, $vemail1)=$db->fetch_row($query);
    }
    $sql = "SELECT gamenum, ";
    $sql = $sql. "       DATE_FORMAT(gamedate, \"%a %b %d  %l:%i%p\"), ";
    $sql = $sql. "       v.teamname AS visitor, ";
    $sql = $sql. "       h.teamname AS home, ";
    $sql = $sql. "       f.field_name ";
    $sql = $sql. "FROM games AS g ";
    $sql = $sql. "JOIN teams AS v ON ( v.id = g.visitorid ) ";
    $sql = $sql. "JOIN teams AS h ON ( h.id = g.homeid ) ";
    $sql = $sql. "JOIN _fields AS f ON (f.id = g.fieldid )";
    $sql = $sql. "WHERE g.gamenum =".$game_num1;
    $query = $db->query($sql);
    if ($db->num_rows($query) > 0) {
      list($gamenum1, $gamedate1, $visitteam1, $hometeam1, $field_name1)=$db->fetch_row($query);
    }
  }
  if ( isset($_POST["gameid_2"]) ) {
    $sql =  "SELECT h.email AS hemail, v.email AS vemail ";
    $sql = $sql. "FROM games AS g ";
    $sql = $sql. "JOIN teams AS v ON ( v.id = g.visitorid ) ";
    $sql = $sql. "JOIN teams AS h ON ( h.id = g.homeid ) ";
    $sql = $sql. "WHERE g.gamenum = ".$_POST["gameid_2"];
    $query = $db->query($sql);
    if ($db->num_rows($query) > 0) {
      list($hemail2, $vemail2)=$db->fetch_row($query);
    }
    $sql = "SELECT gamenum, ";
    $sql = $sql. "       DATE_FORMAT(gamedate, \"%a %b %d  %l:%i%p\"), ";
    $sql = $sql. "       v.teamname AS visitor, ";
    $sql = $sql. "       h.teamname AS home, ";
    $sql = $sql. "       f.field_name ";
    $sql = $sql. "FROM games AS g ";
    $sql = $sql. "JOIN teams AS v ON ( v.id = g.visitorid ) ";
    $sql = $sql. "JOIN teams AS h ON ( h.id = g.homeid ) ";
    $sql = $sql. "JOIN _fields AS f ON (f.id = g.fieldid )";
    $sql = $sql. "WHERE g.gamenum =".$game_num2;
    $query = $db->query($sql);
    if ($db->num_rows($query) > 0) {
      list($gamenum2, $gamedate2, $visitteam2, $hometeam2, $field_name2)=$db->fetch_row($query);
    }
  }
0
 
LVL 27

Expert Comment

by:Cornelia Yoder
ID: 18885194
Well, for one thing, this line looks strange to me...

  $db = new dbstuff;

I don't think that's correct php syntax.
0
MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

 
LVL 26

Author Comment

by:EddieShipman
ID: 18885432
[quote]$db = new dbstuff;[/quote]

That is a db access class that I got from phpclasses.org.
0
 
LVL 26

Author Comment

by:EddieShipman
ID: 18885437
You didn't have to post all that code, all you had to do was say that I needed
a closing } for the if here:

if ( isset($_POST["gameid_1"]) ) {
  .
  .
  if ($db->num_rows($query) > 0) {
    list($gamenum1, $gamedate1, $visitteam1, $hometeam1, $field_name1)=$db->fetch_row($query);
  }
}
0
 
LVL 26

Author Comment

by:EddieShipman
ID: 18885463
[quote]Can you post the full error message? All we received was "parse error, unexpected $ in..."[/quote]
This is the EXACT message sent:

Parse error: parse error, unexpected $ in /home/austin1/public_html/gamechange.php on line 282
0
 
LVL 29

Expert Comment

by:TeRReF
ID: 18885817
Sometimes it's easier to just post some more code instead of explaining where the closing }'s need to be added :)
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Generating table dynamically is the most common issue faced by php developers.... So it seems there is a need of an article that explains the basic concept of generating tables dynamically. It just requires a basic knowledge of html and little maths…
Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this. Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it i…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to count occurrences of each item in an array.

732 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question