简单的删除语句mysql和php。 [英] Simple delete statement mysql and php.
本文介绍了简单的删除语句mysql和php。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个简单的MySQL语句,应删除所选行。我有一个运行良好的更新查询。它插入但不删除。
我不是专家,但查询简单易读。我不明白为什么不删除数据。
表单
I have a simple MySQL statement that should delete the selected row. I have an update query that works well. It inserts but doesn’t delete.
I am not an expert but the query is simple and easy to read. I do not understand why it is not deleting the data.
Form
$Band_id = (int)$_GET['id'];
$result = mysql_query("SELECT * FROM bands ");
echo "<table border = '1'>
<h4>Edit or Deleat Show:</h4>
<tr>
<th>Show No</th>
<th>Band Name</th>
<th>Venue</th>
<th>Category</th>
<th>Stock</th>
<th>Edit Show</th>
<th>Delete Show</th>
</tr>";
while($row = mysql_fetch_array($result))
{
echo "<td>" .$row['Band_id']. "</td>";
echo "<td>" .$row['Name']. "</td>";
echo "<td>" .$row['Venue']. "</td>";
echo "<td>" .$row['Category']. "</td>";
echo "<td>" .$row['Stock']. "</td>";
echo " <input name=\"id\" type=\"hidden\" value=\"". $row["Band_id"] ."\" >";
echo ("<td><a href=\"editband.php?id=$row[Band_id]\"><button>Edit Details</button></a></td>");
echo ("<td><a href=\"delete.php?id=$row[Band_id]\"><button>Deleat Show</button></a></td></tr>");
}
echo "</table>";
delete.php
delete.php
require 'core/init.php';
$Band_id = (int)$_POST['id'];
$result = mysql_query ("DELETE FROM bands WHERE Band_id='$Band_id'");
echo mysql_error();
//header("location:admin.php");
我的尝试:
参考delete.php
What I have tried:
Refer delete.php
推荐答案
Band_id =(int)
Band_id = (int)
_GET [' id'];
_GET['id'];
result = mysql_query( SELECT * FROM bands);
echo < table border ='1'>
< h4>编辑或删除显示:< / h4>
< tr>
< th>显示否< / th>
< th>带名称< / th>
< th> Venue< / th>
< th>类别< / th>
< th>股票< / th>
< th>编辑显示< / th>
< th>删除显示< / th>
< / tr>;
while(
result = mysql_query("SELECT * FROM bands "); echo "<table border = '1'> <h4>Edit or Deleat Show:</h4> <tr> <th>Show No</th> <th>Band Name</th> <th>Venue</th> <th>Category</th> <th>Stock</th> <th>Edit Show</th> <th>Delete Show</th> </tr>"; while(
这篇关于简单的删除语句mysql和php。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文