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
mckinnon81
Forum Newbie
Posts: 12 Joined: Mon Mar 15, 2004 8:02 pm
Location: Sydney
Contact:
Post
by mckinnon81 » Thu Mar 18, 2004 5:04 pm
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ї'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);
?>
What have I done wrong?
Any help would be great thx.
Cheers;
Moe
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 » Thu Mar 18, 2004 5:32 pm
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.............
mckinnon81
Forum Newbie
Posts: 12 Joined: Mon Mar 15, 2004 8:02 pm
Location: Sydney
Contact:
Post
by mckinnon81 » Thu Mar 18, 2004 5:40 pm
Sorry line 34 not 39, but still getting error.
It has something to do with
Code: Select all
if($_GETї'delete'] == "yes"){ 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 » Thu Mar 18, 2004 6:57 pm
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...
phice
Moderator
Posts: 1416 Joined: Sat Apr 20, 2002 3:14 pm
Location: Dallas, TX
Contact:
Post
by phice » Thu Mar 18, 2004 7:40 pm
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.