Parase Error

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
mckinnon81
Forum Newbie
Posts: 12
Joined: Mon Mar 15, 2004 8:02 pm
Location: Sydney
Contact:

Parase Error

Post by mckinnon81 »

I am getting a stupid parase error and I don't know why.
Parse error: parse error, unexpected $ in /web/intranet/admin/test.php on line 39
Here's the code:

Code: Select all

<?php

// Connect to the DB
$db = mysql_connect("localhost", "root");
mysql_select_db("makdap",$db);

if($_GET&#1111;'delete'] == "yes")&#123; // Check if we want to delete something
//$sql = "DELETE FROM internalphone WHERE id=".$_GET&#1111;'id'];
//mysql_query($sql);
//echo $_GET&#1111;'id']." record deleted";
//echo "<meta http-equiv="Refresh" content="3; url=test.php">";
&#125;else&#123; // We dont so show the list
$result = mysql_query("SELECT * FROM internalphone where id=1",$db);
?>
<center>
<table width="65%" border="0" bgcolor="#336699">
	<tr>
<?			

			 print("<td width="15%"><b><font color="white">First Name</td><td width="15%"><b><font color="white">Last Name</td><td width="15%"><b><font color="white">Extension</td><td width="15%"><b><font color="white">Action</td>");
            

while($myrow = mysql_fetch_array($result)) &#123;
    
              echo "<tr>";
                     printf("<td bgcolor=#CDDBEB><font color=#006699>%s</td><td bgcolor=#CDDBEB><font color=#006699>%s</td><td bgcolor=#CDDBEB><font color=#006699>%s</td><td bgcolor=#CDDBEB><font color=#006699><a href="%s?id=%s&delete=yes">Delete</a></td>",$myrow&#1111;"FirstName"],$myrow&#1111;"LastName"],$myrow&#1111;"Extension"],$PHP_SELF,$myrow&#1111;"id"]);
    
              echo "</tr>";
	&#125;
      echo '</table>';
  mysql_close($db);


?>
What have I done wrong?

Any help would be great thx.

Cheers;
Moe
User avatar
dull1554
Forum Regular
Posts: 680
Joined: Sat Nov 22, 2003 11:26 am
Location: 42:21:35.359N, 76:02:20.688W

Post by dull1554 »

thats just it i dont see it here b/c there is no line 39 on here, but look at line 39 there will be an extra '$' somewhere

maybe u forgot a semi-colon.............
User avatar
mckinnon81
Forum Newbie
Posts: 12
Joined: Mon Mar 15, 2004 8:02 pm
Location: Sydney
Contact:

Post by mckinnon81 »

Sorry line 34 not 39, but still getting error.

It has something to do with

Code: Select all

if($_GET&#1111;'delete'] == "yes")&#123;
If I comment it out the page loads fine as soon as i put it back in I get the error
Illusionist
Forum Regular
Posts: 903
Joined: Mon Jan 12, 2004 9:32 pm

Post by Illusionist »

well that if statement is surely not on line 39. It might be helpful if you show us what line 39 is so we know there the erro is coming from...
User avatar
phice
Moderator
Posts: 1416
Joined: Sat Apr 20, 2002 3:14 pm
Location: Dallas, TX
Contact:

Post by phice »

Code: Select all

<?php

// Connect to the DB
$db = mysql_connect("localhost", "root");
mysql_select_db("makdap",$db);

if($_GET['delete'] == "yes"){ // Check if we want to delete something
//$sql = "DELETE FROM internalphone WHERE id=".$_GET['id'];
//mysql_query($sql);
//echo $_GET['id']." record deleted";
//echo "<meta http-equiv="Refresh" content="3; url=test.php">";
}else{ // We dont so show the list
$result = mysql_query("SELECT * FROM internalphone where id=1",$db);
?>
<center>
<table width="65%" border="0" bgcolor="#336699">
   <tr>
<?

          print("<td width="15%"><b><font color="white">First Name</td><td width="15%"><b><font color="white">Last Name</td><td width="15%"><b><font color="white">Extension</td><td width="15%"><b><font color="white">Action</td>");


while($myrow = mysql_fetch_array($result)) {

              echo "<tr>";
                     printf("<td bgcolor=#CDDBEB><font color=#006699>%s</td><td bgcolor=#CDDBEB><font color=#006699>%s</td><td bgcolor=#CDDBEB><font color=#006699>%s</td><td bgcolor=#CDDBEB><font color=#006699><a href="%s?id=%s&delete=yes">Delete</a></td>",$myrow["FirstName"],$myrow["LastName"],$myrow["Extension"],$PHP_SELF,$myrow["id"]);

              echo "</tr>";
   }
      echo '</table>';
  mysql_close($db);

}
?>
You were missing an ending } for the } else { statement. :)
Post Reply