我是一个新手。在我问这个问题之前,我已经为此工作了3天。我已经谷歌搜索了所有内容,但问题与我的事件不一样有同样的错误。请帮帮我。
错误是 -
解析错误:语法错误,第33行的C:\ xampp2 \ htdocs \ LI \ Assignment1 \ edit_projek3.php中的意外文件结束 第33行,这意味着最后一行。
<html>
<head><title>EDIT PROJEK</title></head>
<body>
<?php
$dbcon = mysql_connect("localhost","user","");
if(!$dbcon){
die("Tidak berjaya disambungkan: " . mysql_error());
}
mysql_select_db("dbpelanggan",$dbcon);
if(isset($_POST['update'])){
$UpdateProject = "UPDATE projek SET kod_projek='$_POST[kodBaru], tajuk_projek='$_POST[tajukBaru]', norujukan='$_POST[rujukanBaru]' WHERE kod_projek='$_POST[hidden]'";
mysql_query($UpdateProject, $dbcon);
$listProject = "SELECT * FROM projek";
$queryProject = mysql_query($listProject,$dbcon);
echo "<table border='0' cellpadding='1' cellspacing='1'>
<tr>
<th>Kod Projek</th>
<th>Tajuk Projek</th>
<th>No Rujukan</th>
</tr>";
while($record = mysql_fetch_array($queryProject)){
echo "<form action=edit_projek3.php method=POST>";
echo "<tr>";
echo "<td>" . "<input type=text name=kodBaru value=" . $record['kod_projek'] . " </td>";
echo "<td>" . "<input type=text name=kodBaru value=" . $record['kod_projek'] . " </td>";
echo "<td>" . "<input type=text name=kodBaru value=" . $record['kod_projek'] . " </td>";
echo "<td>" . "<input type=text name=kodBaru value=" . $record['kod_projek'] . " </td>";
echo "<td>" . "<input type=text name=kodBaru value=" . $record['kod_projek'] . " </td>";
echo "</form>";
}
?>
</body>
</html>
提前感谢。
答案 0 :(得分:0)
此错误表示您尚未关闭一个括号。您尚未关闭if(isset($_POST['update'])){
括号。使用以下代码
<html>
<head><title>EDIT PROJEK</title></head>
<body>
<?php
$dbcon = mysql_connect("localhost","user","");
if(!$dbcon){
die("Tidak berjaya disambungkan: " . mysql_error());
}
mysql_select_db("dbpelanggan",$dbcon);
if(isset($_POST['update'])){
$UpdateProject = "UPDATE projek SET kod_projek='$_POST[kodBaru], tajuk_projek='$_POST[tajukBaru]', norujukan='$_POST[rujukanBaru]' WHERE kod_projek='$_POST[hidden]'";
mysql_query($UpdateProject, $dbcon);
$listProject = "SELECT * FROM projek";
$queryProject = mysql_query($listProject,$dbcon);
echo "<table border='0' cellpadding='1' cellspacing='1'>
<tr>
<th>Kod Projek</th>
<th>Tajuk Projek</th>
<th>No Rujukan</th>
</tr>";
while($record = mysql_fetch_array($queryProject)){
echo "<form action=edit_projek3.php method=POST>";
echo "<tr>";
echo "<td>" . "<input type=text name=kodBaru value=" . $record['kod_projek'] . " </td>";
echo "<td>" . "<input type=text name=kodBaru value=" . $record['kod_projek'] . " </td>";
echo "<td>" . "<input type=text name=kodBaru value=" . $record['kod_projek'] . " </td>";
echo "<td>" . "<input type=text name=kodBaru value=" . $record['kod_projek'] . " </td>";
echo "<td>" . "<input type=text name=kodBaru value=" . $record['kod_projek'] . " </td>";
echo "</form>";
}
}
?>
</body>
</html>
希望这有助于你