基本上,我有一个页面并在当前页面上执行删除查询,如:dir-lawyers.php?page = 4
每当我点击特定律师进行查询时,它工作正常,但它重定向到dir-lawyers.php而不是dir-lawyers.php?page = 4
我的设计视图代码如下所示。
<td align="center"><a href=dir-lawyers.php?mode=del&id=<?php echo $data['id'];?>></a></td>
&#13;
php代码是..
if(isset($_GET['mode']) && $_GET['mode']=='del') {
$del="delete from users where id='$id'";
$query=mysql_query($del);
if($query){
echo "Record Deleted";
header("Refresh:0");
}
}
答案 0 :(得分:1)
首先缺少页面参数,所以像这样添加
<td align="center"><a href=dir-lawyers.php?page=4&mode=del&id=<?php echo $data['id'];?></a></td>
第二件事是你在dir-lawyers.php页面上使用$ id之前 你必须从$ _GET ['id']获得$ id ..
if(isset($_GET['mode']) && $_GET['mode']=='del') {
$id = $_GET['id'];
$del="delete from users where id='$id'";
$query=mysql_query($del);
if($query){
echo "Record Deleted";
header("Refresh:0");
}
}
答案 1 :(得分:0)
DTOSaveFromFile file = new DTOSaveFromFile(obj.ReportName, obj.Email, obj.Time); File[0] = obj.ReportName; File[1] = obj.Email; List<DTOSaveFromFile> files = new List<DTOSaveFromFile>(1); files.Add(file); DiskFile.Save(files);
参数缺失
将其用作:
page=4