我正在制作一个应用程序,其中有这张表:
<?php
require_once 'Connect2db3.php';
?>
<form>
<fieldset>
<article class="rondehoeken">
<header>
<div class="streep1"></div>
<div class="streep2"></div>
<div class="streep3"></div>
<div class="streep4"></div>
<div class="streep5"></div>
<h1 id="artikel-titel" >Op Vooraad</h1>
</header>
<div id="artikel-container">
<table class="table 1">
<thead>
<title>Inventory Grid.html</title>
<meta charset = "UTF-8" />
<style type = "text/css">
table, td, th {
border: 1px solid black;
}
</style>
</thead>
<tbody>
<?php
$con=mysqli_connect("localhost","root","admin","inventarisdb");
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$result = mysqli_query($con,"SELECT * FROM BCD");
echo "<table border='0'>
<tr>
<th>Categorie</th>
<th>SerieNummer</th>
<th>MacAdress</th>
<th>ProductCode</th>
<th>Prijs</th>
<th>RekNummer</th>
<th>PaletNummer</th>
<th>Hoeveelheid</th>
<th>Aantekeningen</th>
</tr>";
while($row = mysqli_fetch_array($result))
{
echo "<tr>";
echo "<td>" . $row['Categorie'] . "</td>";
echo "<td>" . $row['SerieNummer'] . "</td>";
echo "<td>" . $row['MacAdress'] . "</td>";
echo "<td>" . $row['ProductCode'] . "</td>";
echo "<td>" . $row['Prijs'] . "</td>";
echo "<td>" . $row['RekNummer'] . "</td>";
echo "<td>" . $row['PaletNummer'] . "</td>";
echo "<td>" . $row['Hoeveelheid'] . "</td>";
echo "<td>" . $row['Aantekeningen'] . "</td>";
echo '<td><input type="hidden" class="entryid" name="id" value='.$row['ID'].' /><a href="#" class="delete">delete</a></td>';
echo "</tr>";
}
echo "</table>";
mysqli_close($con);
?>
</article>
</fieldset>
</form>
在标题中:
删除表格:
<?php
$db = array (
'host' => 'localhost',
'user' => 'root',
'pass' => 'admin',
'dbname' => 'inventarisdb'
);
if(!mysql_connect($db['host'], $db['user'], $db['pass']))
{
trigger_error('Fout bij verbinden: '.mysql_error());
}
elseif(!mysql_select_db($db['dbname']))
{
trigger_error('Fout bij selecteren database: '.mysql_error());
}
else
{
$sql = "SET SESSION sql_mode = 'ANSI,ONLY_FULL_GROUP_BY'";
if(!mysql_query($sql))
{
trigger_error('MySQL in ANSI niet mogelijk');
}
}
$id = $_GET['id'];
$sql="DELETE FROM BCD WHERE id='$Categorie', '$SerieNummer', '$MacAdress', '$ProductCode', '$Prijs', '$RekNummer','$PaletNummer' ,'$Hoeveelheid', '$Aantekeningen'";
?>
该表从另一个表中查找数据,还提供了从数据库中删除该表中的行的选项。
我刚才所说的这个表的所有内容都适用于这个脚本,除了从我的数据库中实际删除的数据。按下删除后,将执行删除操作,并提示您将删除一行。它将它从表中删除,但是当您签入数据库或只是用表刷新页面时,该行仍然存在并且没有被删除
任何想法为什么会发生这种情况或该怎么做?或者也许怎么做更容易?