ESchmidgall
Technical User
I inherited some php script from a previous user and have been told to update it. I'm not very good at php so this is proving to be a challenge. I am getting this error:
Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING in /usr/local/apache2/htdocs/Emma/query186.php on line 206
which I understand is often caused by missing ; at the end of a line. However, I've checked all around line 206 and to my undiscerning eyes, everything looks okay.
This script is supposed to query a mySQL database, print out the results in the table, and allow modification of the database through the webpage. Here's the code, could you please help me find the cause of this error?
<---------------begin code------------->
$db->query($q);
while(list($RODid, $CCU, $RODtype, $Location, $OtherLoc, $Layer, $Position, $flag, $comments) = $db->data())
{
echo("<tr><td>".$RODid."</td><td>".$CCU."</td><td>".$RODtype."</td><td>".$Location."</td><td>".$OtherLoc."</td><td>".$Layer."</td><td>".$Position."</td><td>".$flag."</td><td>".$comments."</td><td><FORM METHOD=\"post\" ACTION=\"query186.php\"><input type=\"hidden\" Name=\"method\" Value=\"remove\"><input type=\"hidden\" Name=\"RODid_\" value=".$RODid."><input type=\"hidden\" Name=\"CCU_\" value=".$CCU."><input type=\"hidden\" Name=\"RODtype_\" Value=".$RODtype_."><input type=\"hidden\" Name=\"Location_\" Value=".$Location_."><input type=\"hidden\" Name=\"OtherLoc_\" Value=".$OtherLoc_."><input type=\"hidden\" Name=\"Layer_\" Value=".$Layer_."><input type=\"hidden\" Name=\"Position_\" value=".$Position_."><input type=\"hidden\" Name=<input type=\"hidden\" Name=\"flag_\" Value=".$flag_."> <input type=\"submit\" Value=\"Remove\" size=\"10\"><br></FORM></td></tr>");
}
echo("</tbody></table>");
break;
case remove:
if($Location_>0 && RODid_>0)
{
$db->query("DELETE FROM rods186 WHERE RODid=".$RODid);
****LINE206*** echo("OK, removed rod number ".$RODid "from previous location" .$Location); ****END LINE 206***********
}
else{
echo("<span style=\"color:red\"><B>Check your values!</B></span>");
}
break;
case insert:
if($Location_>0 && $Layer_>0 && $Position_>0 && $CCU_>0 && $RODid_>0)
{
$q = "INSERT INTO rods186 VALUES (".$RODid_.",".$CCU_.",'".$RODtype_."','".$Location_."', '".$OtherLoc_."', ".$Layer_.", ".$Position_.", '".$flag_."','".$comments_."');";
$results = $db->query($q);
if($results == 1)
echo("Ok. Rod inserted with: <TT>".$q."</TT><br>");
else
echo("<span style=\"color:red\"><B>Error! Rod not inserted!</B></span> (<TT>".$q."</TT>)<br>");
}
else{
echo("<span style=\"color:red\">Check your values!</span>");
}
break;
default:
break;
Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING in /usr/local/apache2/htdocs/Emma/query186.php on line 206
which I understand is often caused by missing ; at the end of a line. However, I've checked all around line 206 and to my undiscerning eyes, everything looks okay.
This script is supposed to query a mySQL database, print out the results in the table, and allow modification of the database through the webpage. Here's the code, could you please help me find the cause of this error?
<---------------begin code------------->
$db->query($q);
while(list($RODid, $CCU, $RODtype, $Location, $OtherLoc, $Layer, $Position, $flag, $comments) = $db->data())
{
echo("<tr><td>".$RODid."</td><td>".$CCU."</td><td>".$RODtype."</td><td>".$Location."</td><td>".$OtherLoc."</td><td>".$Layer."</td><td>".$Position."</td><td>".$flag."</td><td>".$comments."</td><td><FORM METHOD=\"post\" ACTION=\"query186.php\"><input type=\"hidden\" Name=\"method\" Value=\"remove\"><input type=\"hidden\" Name=\"RODid_\" value=".$RODid."><input type=\"hidden\" Name=\"CCU_\" value=".$CCU."><input type=\"hidden\" Name=\"RODtype_\" Value=".$RODtype_."><input type=\"hidden\" Name=\"Location_\" Value=".$Location_."><input type=\"hidden\" Name=\"OtherLoc_\" Value=".$OtherLoc_."><input type=\"hidden\" Name=\"Layer_\" Value=".$Layer_."><input type=\"hidden\" Name=\"Position_\" value=".$Position_."><input type=\"hidden\" Name=<input type=\"hidden\" Name=\"flag_\" Value=".$flag_."> <input type=\"submit\" Value=\"Remove\" size=\"10\"><br></FORM></td></tr>");
}
echo("</tbody></table>");
break;
case remove:
if($Location_>0 && RODid_>0)
{
$db->query("DELETE FROM rods186 WHERE RODid=".$RODid);
****LINE206*** echo("OK, removed rod number ".$RODid "from previous location" .$Location); ****END LINE 206***********
}
else{
echo("<span style=\"color:red\"><B>Check your values!</B></span>");
}
break;
case insert:
if($Location_>0 && $Layer_>0 && $Position_>0 && $CCU_>0 && $RODid_>0)
{
$q = "INSERT INTO rods186 VALUES (".$RODid_.",".$CCU_.",'".$RODtype_."','".$Location_."', '".$OtherLoc_."', ".$Layer_.", ".$Position_.", '".$flag_."','".$comments_."');";
$results = $db->query($q);
if($results == 1)
echo("Ok. Rod inserted with: <TT>".$q."</TT><br>");
else
echo("<span style=\"color:red\"><B>Error! Rod not inserted!</B></span> (<TT>".$q."</TT>)<br>");
}
else{
echo("<span style=\"color:red\">Check your values!</span>");
}
break;
default:
break;