正在删除配置文件请求


Deleting a profile request?

我是一个新手,试图删除配置文件,但地址栏中弹出此消息

http://thexyz.com/the/delete.php?id=1>

我是否犯了任何语法错误我的代码如下-

<?php 
    $i=1; 
    while($row=mysql_fetch_array($rw)) { ?>
        <tr>
            <td><?php echo $i; ?></td>  
            <td align="center">
                <a href="delete.php?id=<?php echo $row['Customer Id']; ?> "onclick="return chkstatus();">
                <img src="resources/images/icons/user_delete.png" width="16" height="16"/></a>delete
            </td>

即使删除也不起作用

我的delete.php代码是

<?php
    session_start();
    if($_SESSION['username']=="");
        include_once('db.php');
    if( isset($_GET['del']) ) {
        $id = $_GET['del'];
        $sql= "DELETE FROM opd WHERE Sno='$Sno'";
        $res= mysql_query($sql) or die("Failed".mysql_error());
        echo "<meta http-equiv='refresh' content='0;url=index.php'>";
    }
?>

您必须在?> 之后删除>

你的<a href应该是这样的:

<a href="delete.php?id=<?php echo        
$row['Customer Id']; ?>" onclick="return chkstatus();">

在您的delete.php 中

if($_SESSION['username']==""); // IT will do nothing here

上面的代码不会做任何事情,因为您已经用分号终止了语句;

您正在传递id而非模型

因此$_GET['del']应更改为$_GET['id']

$sql= "DELETE FROM opd WHERE Sno='$Sno'";

更改为

 $sql= "DELETE FROM opd WHERE Sno='$id'";