PHP删除评论错误

时间:2014-04-01 10:34:27

标签: php

好的,问题是,我无法删除任何评论。 我一直在看一些指南但是找不到多少帮助,这里是代码;

<?php
include "core/inc/conn.php";

mysql_select_db("comments");

$getquery = mysql_query("SELECT * FROM comments ORDER BY id DESC");
while($rows = mysql_fetch_assoc($getquery))
 {
     $id = $rows['id'];
     $comment_name = $rows['name'];
     $comment = $rows['comment'];
     $dellink = "<a href=\delete.php?id=' . $id . \'> Delete </a>";


     echo"<tr><th>$id</th>";
     echo"<th><form action='checked.php' method='checked'></th>";
     echo "<th>$comment_name</th>";
     echo"<th>$comment</th>";
     echo"<th>$dellink</th>";
    echo"<th>$ipserver</th></tr>";


 }

    if(isset($_GET['error']))
{
    echo "<p>15 Bokstäver max!";

}


?>

$ dellink不起作用,这里是delete.php;

<?php
include "core/inc/conn.php";

mysql_select_db('comments');


$deleteid = $_GET['id'];
mysql_query("DELETE FROM comments WHERE id='$deleteid'");
header("location: administrative/logs.php");

?>

1 个答案:

答案 0 :(得分:0)

PHP回显您的删除链接并不是正确的,请尝试:

$dellink = '<a href="delete.php?id=' . $id . '> Delete </a>';

* [强制要求不要使用mysql_ functions text] *