把你每条记录的ID也列出来,用复选框去决定要删除哪条ID!

解决方案 »

  1.   

    文章名称  文章类型   上传时间   阅读次数  id(hidden)    删除选择 
    测试        PHP      2002-08-05     26         12     checkbox复选框
    $row[1]="测试" $row[2]="php" $row[3]="2002-08-05".....$row[x]=id 
    <input type=checkbox name=del_id value="<?php edho $row[id];?>">
    $query="del from $table_name where id="del_id"";
    $result=mysql_query($query);
    统计选中的总数,放入一个循环即可.
      

  2.   

    to  sup_haiker(轩辕才子) 我已经试了你写的代码
    的确可以删除文章,不过一次只能删除一个id所对应的文章
    如果一次通过checkbox复选框选择多个id,也只能删除id最小的文章
    请问我该如何处理???
    我写的代码如下:
    --------delete_word1.php---------<form method="POST" action="delete_word2.php">
    <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber1">
      <tr>
        <td width="40%" align="center">文章名称</td>
        <td width="15%" align="center">文章类型</td>
        <td width="15%" align="center">上传时间</td>
        <td width="15%" align="center">阅读次数</td>
    <td width="15%" align="center">删除选择</td>
      </tr>
    <?php
    if($offset=="")
    {
    $offset=0;
    }
    $connid=mysql_connect("localhost","","");
    $sql="select id,title,type,time,number from word order by id";
    $result=mysql_db_query("supersite",$sql);$fsql="select id from word";
    $fresult=mysql_db_query("supersite",$fsql);
    $num=mysql_num_rows($fresult);if ($num != 0)
    {
    while($r=mysql_fetch_array($result))
    {
    $id=$r["id"];
    $ftitle=$r["title"];
    $ftype=$r["type"];
    $ftime=$r["time"];
    $ftime=substr($ftime,0,10);
    $fnumber=$r["number"];
    echo "<tr><td width='/40%'/>";
    echo "<a href=update_word2.php?id=$id>";
    echo $ftitle;
            echo "</a></td><td width=/'15%'/>";
    echo $ftype;
    echo "</td><td width=/'15%'/>";
            echo $ftime;
    echo "</td><td width=/'15%'/>";
    echo $fnumber;
    echo "</td><td width=/'15%'/>";
    echo "<input type=checkbox name=del_id value=$id>";
    echo "</td></tr>";
    }
    }
    ?>
    </table><input type="submit" value="提交" name="B1" style="float: right"><input type="reset" value="重置" name="B2" style="float: right"></form>--------delete_word2.php---------<?php
    echo $del_id;
    $connid=mysql_connect("localhost","","");
    $query="delete from word where id='$del_id'";
    if (mysql_db_query("supersite",$query));
    {
    echo "文章删除完毕!";
    }
    ?>
      

  3.   

    try:list.php
    <?php//name:list.php
    // bye eagle_gui -- >http://www.ggajj.net
    // 2002-08-06
    print"<form name=artical action=del.php method=post>";print"<table width=100% border=1>";
    print"<tr>
    <td>文章名称</td><td>文章类型</td><td>上传时间</td><td> 阅读次数</td><td> 删除选择 </td></tr>";
    for ($i=0;$i<$total;$i++)
    {
    print"<tr><TD>$title</td> <TD>$type</td><TD>$date</td><TD>$clicks</td><TD><input type=checkbox naem=delartical[] value=$id></td>}
    print"<tr><td><input type=submit value=删除></td></tr></table>";
    print"</form>";?>
    del.php
    <?php//-----name:del.php
    // By eagle_gui :http://www.ggajj.net
    // 2002-08-06$total=sizeof($delartical);
    for ($i=0;$i<$total;$i++)
    {
    $connid=mysql_connect("localhost","","");
    $query="delete from word where id='$delartical[$i]'";
    $res=mysql_query($query,$connid) or die ("无法删除");
    }
    print"<P align=center><BR><BR><BR>成功删除,请<a href=list.php>返回</a></p>";
    ?>