尽管传递了 'id',删除功能仍未执行

Delete function not executing despite 'id' being passed

我有这段代码可以在收据页面显示记录。

 <?Php
    require "config.php";           

    $page_name="currentout.php";  
    $start=$_GET['start'];
    if(strlen($start) > 0 and !is_numeric($start)){
    echo "Data Error";
    exit;
    }


    $eu = ($start - 0); 
    $limit = 10;                                 
    $this1 = $eu + $limit; 
    $back = $eu - $limit; 
    $next = $eu + $limit; 

    $nume = $dbo->query("select count(id) from receipt")->fetchColumn();


    echo "<TABLE class='t1'>";
    echo  "<tr><th>ID</th><th>Name</th><th>Pass</th><th>Amount</th><th>Action</th></tr>";


    $query=" SELECT * FROM receipt  limit $eu, $limit ";


    foreach ($dbo->query($query) as $row) {

    @$m=$i%2;
    @$i=$i+1;   
    echo "<tr class='r$m'><td>$row[id]</td><td>$row[name]</td><td>$row[phone_num]</td><td>$row[Amount]</td><td><a href='delete.php?id=$row[id]'>delete</a></td></tr>";
    }
    echo "</table>";

    if($nume > $limit ){ 
    echo "<table align = 'center' width='50%'><tr><td  align='left' width='30%'>";

    if($back >=0) { 
    print "<a href='$page_name?start=$back'><font face='Verdana' size='2'>PREV</font></a>"; 
    } 

    echo "</td><td align=center width='30%'>";
    $i=0;
    $l=1;
    for($i=0;$i < $nume;$i=$i+$limit){
    if($i <> $eu){
    echo " <a href='$page_name?start=$i'><font face='Verdana' size='2'>$l</font></a> ";
    }
    else { echo "<font face='Verdana' size='4' color=red>$l</font>";}        
    $l=$l+1;
    }


    echo "</td><td  align='right' width='30%'>";

    if($this1 < $nume) { 
    print "<a href='$page_name?start=$next'><font face='Verdana' size='2'>NEXT</font></a>";} 
    echo "</td></tr></table>";

    } 
    ?>

这是链接的 delete.php 的代码。

<?php
require "config.php";
$pdo="null";
$sql = "DELETE FROM receipt  WHERE ID=  :ID";
$stmt = $pdo->prepare($sql);
$stmt->bindParam(':ID', $_GET['id'], PDO::PARAM_INT);  
$stmt->execute($sql);
       echo "Record deleted successfully";


   header('location: currentout.php');
?>

'id' 正在传递到删除页面,但删除功能未执行。有人可以协助发现 delete.php 中的错误吗??

您将 $pdo 设置为 'null' 然后您尝试将其用作对象。启用错误报告,您会看到相关的错误消息。