gpt4 book ai didi

php - 在数据库中删除后更新 php

转载 作者:行者123 更新时间:2023-11-28 02:58:41 24 4
gpt4 key购买 nike

这是 user_list.php 获取 $txt 以查询“where Like”的主页面。

<?php
include_once('dbConfig.php');

$result = mysqli_query($conn,"SELECT * FROM compid");
<title>Computer Record</title>
</head>
<body><thead>
<tr>
<th id='time'> </th>
<th>Computer ID</th>
<th id='time'>ComputerName</th>
<th id='title'>Status</th>
<th id='cost'>IP</th>
<th id='size'>OS</th>
<th id='author'>RAM</th>
<th id='author'>CPU</th>
<th id='author'>Machine Model</th>
<th id='author'>Serial Number</th>
<th id='author' >Remarks</th>
<th id='author'>Application</th>
<th id='author'>User</th>
<th id='author'>Delete</th>
<th id='author'>Edit</th>
</tr></thead>
";
while($row = mysqli_fetch_array($result))
{
echo"<tbody>";

echo "<td><input type='checkbox' name='Days[]' value=". $row['cid'] ."> </td>";
echo "<td>" . $row['cid'] . "</td>";
echo "<td>" . $row['cname'] . "</td>";
echo "<td>" . $row['stat'] . "</td>";
echo "<td>" . $row['ip'] . "</td>";
echo "<td>" . $row['os'] . "</td>";
echo "<td>" . $row['ram'] . "</td>";
echo "<td>" . $row['cpu'] . "</td>";
echo "<td>" . $row['mmodel'] . "</td>";
echo "<td>" . $row['snumber'] . "</td>";
echo " <td>" . $row['remarks'] . "</td>";
echo "<td ><a href='App_List.php?cname=" . $row['cname'] . "'><img src='http://10.9.57.129:8888/SGSComputer5.3/FINAL/images/view.png' style='border-style: none'></a></td>";
echo "<td><a href='User_List.php?cname=" . $row['cname'] . "'><img src='http://10.9.57.129:8888/SGSComputer5.3/FINAL/images/user_group.png' style='border-style: none'></a></td>";
echo "<td><a href='del_Main.php?ID=" . $row['ID'] . "' onclick='return checkDelete()'><img src='http://10.9.57.129:8888/SGSComputer5.3/FINAL/images/erase.png' style='border-style: none'></a></td>";
echo "<td><a href='Edit_Main.php?ID=" . $row['ID'] . "'><img src='http://10.9.57.129:8888/SGSComputer5.3/FINAL/images/edit.png' style='border-style: none'></a></td>";
}
echo "</table>";?>
?>

这是 User_List.php

   if(isset($_GET['cname'])) {
$txt= $_GET['cname'];
$result = mysqli_query($con,"SELECT * FROM user Where cname like '$txt'");
echo"<body bgcolor='#696969'>
<input type='submit' value='Export' method='post'>
</head>";
echo "<table border='1'>
<tr>

<th>Users</th>
<th> </th>
</tr>";
while($row = mysqli_fetch_array($result))
{
$one = $row['cname'];
echo "<tr>";

echo "<td>" . $row['user'] . "</td>";
echo "<td><a href='User_List.php?ID=" . $row['ID'] . "' onclick='return checkDelete()'><img src='http://10.9.57.129:8888/SGSComputer5.3/FINAL/images/erase.png' style='border-style: none'></a></td>"; echo "</tr>";


echo "</tr>";
}
echo "</table>";

这是我在表中的删除按钮我如何更新页面这是 delete.php:

if(isset($_GET['ID'])) {

$result = mysqli_query($conn,"DELETE FROM `SGSCOMP`.`user` WHERE `user`.`ID` = ".$_GET["ID"]);
}

如何回到用户列表

最佳答案

你可以做一个headerdelete.php 中更新查询后直接重定向。

header("location:User_List.php")

这会将用户重定向回 User_List.php

header() is used to send a raw HTTP header. See the » HTTP/1.1 specification for more information on HTTP headers.

关于php - 在数据库中删除后更新 php,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35650255/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com