我在做一個應用程序中,我有這個表:發行使用HTML刪除從我的數據庫行時,PHP,JS
<?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'";
?>
該表查找來自另一個表的數據,還提供了刪除該行的選項來自數據庫的表格。
我剛纔所說的一切,這個表格確實適用於這個腳本,除了數據實際上從我的數據庫中刪除。一旦按下刪除刪除操作得到執行提示一個所有說你要刪除一行。它將它從表格中刪除,但是當您檢入數據庫或只是使用表格刷新頁面時,該行仍然存在並且尚未刪除
任何想法爲什麼會發生這種情況或者該怎麼辦?或者,也許如何做到這一點更容易?
最好將標題標籤移動到標籤頭部! – undone