我是一名vba开发人员,因此我对如何将记录ID解析为isset()感到非常困惑。 我在这里查看了各种帖子并尝试过很多东西,但记录不会删除。页面刷新。 isset必须失败。我尝试过给名字&价值,但我使用的组合不起作用。
<?php
session_start();
$user_mail = $_SESSION['username'];
if ($user_mail) {
include 'database/db.php';
if(isset($_GET['delete_id'])) {
$sql_query="DELETE FROM `job_request` WHERE job_request.job_id=".$_GET['delete_id']." AND job_request.Email='$user_mail'";
mysql_query($sql_query);
header("Location: applied_jobs.php");
}
?> etc ...
以这种方式使用:
<?php
$result = mysql_query("SELECT * FROM `jobs` INNER JOIN job_request ON job_request.job_id=jobs.ReqID where job_request.Email='$user_mail' ORDER BY job_request.Applied_Date DESC");
$n = mysql_num_rows($result);
if ($n > 0) {
while ($row = mysql_fetch_array($result)) {
?>
<div id="lb" class="col-md-12" >
<h4 style="color:black;"><?php echo $row['Job_Title'] ?>
<a href="applied_jobs.php?delete_id=<?php echo $row['job_id']; ?>" onclick="return confirm('Delete this record?');" data-placement="top" data-toggle="tooltip" title="Delete Record">
<button class="btn-danger btn-md pull-right" data-title="Delete"> <span class="glyphicon glyphicon-trash"></span></button></a>
</h4>
感谢您提前设置job_id变量以删除记录
答案 0 :(得分:0)
你可以改变
stdlib.h
到
mysql_query($sql_query);
从mysql获取查询的任何错误。
可能该值未通过: 改变:
mysql_query($sql_query) or die(mysql_error());
为:
<a href="applied_jobs.php?delete_id=<?php echo $row['job_id']; ?>" onclick="return confirm('Delete this record?');" data-placement="top" data-toggle="tooltip" title="Delete Record">
<button class="btn-danger btn-md pull-right" data-title="Delete"> <span class="glyphicon glyphicon-trash"></span></button></a>
删除按钮并将类应用于标签