Solved

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

Posted on 2007-04-10
7
239 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
Don't Cry: How Liquid Web is Ensuring Security

WannaCry is just the start. Read how Liquid Web is protecting itself and its customers against new threats.

 
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

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

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

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
This article discusses four methods for overlaying images in a container on a web page
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 create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

696 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