我的数据库中有一个错误。据说代码中的第 41 行到第 50 行有未定义的索引。在我的网站中,我尝试将表单中的数据插入到 PhpMyAdmin 数据库中,除此之外一切正常。 ..
错误是:注意:未定义索引:第 41 - 50 行 C:\xampp\htdocs\ers\Database.php 中的服务
数据库.php:
<html>
<body>
<?php
$con = mysql_connect("localhost","root","123");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
// some code
?>
<table border="1">
<tr >
<td>Finding</td>
<td>ServiceType</td>
<td>Title</td>
<td>RootCause</td>
<td>RiskRating</td>
<td>Impact</td>
<td>Efforts</td>
<td>Likelihood</td>
<td>Finding</td>
<td>Implication</td>
<td>Recommendation</td>
<td>Report</td>
</tr>
<?php
mysql_select_db ( "ers_1", $con);
$sql="INSERT INTO findings (ServiceType_ID, Title, RootCause_ID, RiskRating_ID, Impact_ID, Efforts_ID, Likelihood_ID, Finding,Implication, Recommendation, Report_ID) VALUES (
'$_POST[Services]',
'$_POST[title]',
'$_POST[RootCause]',
'$_POST[RiskRating]',
'$_POST[impact]',
'$_POST[Efforts]',
'$_POST[likelihood]',
'$_POST[Finding]',
'$_POST[Implication]',
'$_POST[Recommendation]',
'1'
)";
$result = mysql_query("SELECT * FROM findings");
while($row = mysql_fetch_assoc($result))
{
echo "<tr>";
echo "<td>" . $row['Finding_ID'] . "</td>";
echo "<td>" . $row['ServiceType_ID'] . "</td>";
echo "<td>" . $row['Title'] . "</td>";
echo "<td>" . $row['RootCause_ID'] . "</td>";
echo "<td>" . $row['RiskRating_ID'] . "</td>";
echo "<td>" . $row['Impact_ID'] . "</td>";
echo "<td>" . $row['Efforts_ID'] . "</td>";
echo "<td>" . $row['Likelihood_ID'] . "</td>";
echo "<td>" . $row['Finding'] . "</td>";
echo "<td>" . $row['Implication'] . "</td>";
echo "<td>" . $row['Recommendation'] . "</td>";
echo "<td>" . $row['Report_ID'] . "</td>";
//echo "<td><a href='edit.php'>[EDIT]</a> <a href='delete_risk.php?risk_no=" . $row['risk_no'] . "'>[DELETE]</a></td>";
echo "</tr>";
}
mysql_close($con);
?>
<input type="button" value="Back" onclick="window.location.href='option_Frame.php'" />
</body>
</html
>