Page 1 of 1

Parase Error

Posted: Thu Mar 18, 2004 5:04 pm
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

Posted: Thu Mar 18, 2004 5:32 pm
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.............

Posted: Thu Mar 18, 2004 5:40 pm
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

Posted: Thu Mar 18, 2004 6:57 pm
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...

Posted: Thu Mar 18, 2004 7:40 pm
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. :)