Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2007-04-10
7
Medium Priority
?
244 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 2000 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
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…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Suggested Courses

618 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