DW做的简单PHP管理

WBOY
Release: 2016-06-23 13:38:27
Original
1358 people have browsed it

在这个页面,有二个行为按钮,一个是“修改”,一个是“删除”。

点“修改”,没有问题;如下图所示:

点“删除”后,跳转后的页面无数据记录,其实这时在浏览页面里已经看不到了。
按正常是跳转到正式的删除页面,然后点击对应记录条下面的删除按钮,才完成删除,这样才对啊?

问题是出在哪儿了呢?


回复讨论(解决方案)

删除的查询语句是怎样的

if ((isset($_GET['id'])) && ($_GET['id'] != "")) {
  $deleteSQL = sprintf("DELETE FROM price WHERE id=%s",
                       GetSQLValueString($_GET['id'], "text"));

  mysql_select_db($database_myconn, $myconn);
  $Result1 = mysql_query($deleteSQL, $myconn) or die(mysql_error());
}

$colname_Recordset1 = "1";
if (isset($_GET['id'])) {
  $colname_Recordset1 = (get_magic_quotes_gpc()) ? $_GET['id'] : addslashes($_GET['id']);
}
mysql_select_db($database_myconn, $myconn);
$query_Recordset1 = sprintf("SELECT * FROM price WHERE id = %s", $colname_Recordset1);
$Recordset1 = mysql_query($query_Recordset1, $myconn) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);

if (isset($_GTE['id'])){
$query_Recordset1 = sprintf("SELECT * FROM price WHERE id = %s", $colname_Recordset1);
}else{
$query_Recordset1 = "SELECT * FROM price WHERE 1=1";
}

if (isset($_GTE['id'])){
$query_Recordset1 = sprintf("SELECT * FROM price WHERE id = %s", $colname_Recordset1);
}else{
$query_Recordset1 = "SELECT * FROM price WHERE 1=1";
}


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
大神,小弟还是没有看懂。

估计你是直接执行了删除代码了

估计你是直接执行了删除代码了

qq吧

编辑页面:
删除

删除页面:
if($_POST) {
  是表单提交,执行删除
}else {
  通过 $_GET['id'] 得到待删除记录,生成删除页面
}

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!