Solved

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

Posted on 2007-04-10
7
232 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
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:yodercm
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
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 
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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Suggested Solutions

Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
This article discusses how to create an extensible mechanism for linked drop downs.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
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 …

707 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now