网页中需要一个管理员批量删除的功能. 
代码如下<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Apply for license</title>
</head><body>
<form action="delete.php" method="post">
<table border="1" width="60%" align="center">
<caption>All video</caption>
<th> ID</th><th>Name</th>
<?php
mysql_connect("localhost","root","");
mysql_select_db("robotcite");
$exec="select * from video";
$result=mysql_query($exec);
while($rs=mysql_fetch_object($result))
{
$id=$rs->idVideo;
$name=$rs->name;
?>
<tr>
<td><input type="checkbox" name=de[] value=<?php echo $id ?>></td><td><?php echo $name ?></td>//我在$id,$name后面加上;号也不行
</tr>
<?php
}
mysql_close();
?>
</table>
<center><input type="submit" value="delete"></center>
</form> 
</html>
但是调试了好久就是什么都不显示. 数据库能够正常连接. 估计还是php语法方面的问题. 希望各位高手指点指点.
先谢谢了

解决方案 »

  1.   


    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>Apply for license</title>
    </head><body>
    <form action="delete.php" method="post">
    <table border="1" width="60%" align="center">
    <caption>All video</caption>
    <th> ID</th><th>Name</th><?php
    mysql_connect("localhost","root","");
    mysql_select_db("robotcite");
    $exec="select * from video";
    $result=mysql_query($exec);
    ///////////////////////////////////////////////////////////////////////////////////////
    while($rs=mysql_fetch_object($result))
    {
    $id=$rs->idVideo;
    $name=$rs->name;
    ?>
    <tr>
    <td><input type="checkbox" name=de[] value=<?php echo $id ?>></td><td><?php echo $name ?></td>//我在$id,$name后面加上;号也不行
    </tr>
    <?php
    }
    mysql_close();
    ///////////////////////////////////////////////////////////////////////////////////
    ?>
    </table>
    <center><input type="submit" value="delete"></center>
    </form> 
    </html>
    只是把name和id取出来分别输入到checkbox和td里面。别的你什么都没干啊。。
      

  2.   

    我用我自己的数据库测试过了,可以显示的,主要以下几点
    mysql_connect("localhost","root","");   //检查数据库是否有连接成功 $link = mysql_connect("localhost","root","") or die("Could not connect: " . mysql_error());mysql_select_db("robotcite"); //mysql_select_db(robotcite, $link ) or die ('Can\'t use robotcite: ' . mysql_error());
    $exec="select * from video";
    $result=mysql_query($exec);
    while($rs=mysql_fetch_object($result))
    {
    $id=$rs->idVideo;   //这里要认真检查下,这个$rs->idVideo $name=$rs->name (这里的idVideo,name 是video表里面的字段吗,其他地方没有什么问题了
    $name=$rs->name;   
    ?>
    <tr>
    <td><input type="checkbox" name=de[] value=<?php echo $id ?>></td><td><?php echo $name ?></td>