网页中需要一个管理员批量删除的功能.
代码如下<!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语法方面的问题. 希望各位高手指点指点.
先谢谢了
代码如下<!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语法方面的问题. 希望各位高手指点指点.
先谢谢了
解决方案 »
- 请教高手,网站登录时报错:Fatal error: Cannot use object of type publisher as array in:
- 请问能否在网页中播放警报声?
- 截取汉字出现乱码的问题
- 大家使用smarty的时候都是采用的分界符是什么啊?我用默认的大括号,可是如果模板页面中有style标签时就会出错了
- 北京的小女生爱上了写程序,各位帮忙哦
- $query="select count from count";运行mysql_fecthobject正常,可是换成$query="select count from count where Id=1"就报错,为什么?
- IP 来源查找 PHP源码……
- 高分求php+Access的聊天室,bbs,新闻管理的源码!不少于1000分!~
- thinkphp怎么使用mongdb原生sql ?
- 关于PHP公网项目获取访问者IP,却只能获取到局域网IP的情况
- PHP 开发OA遇到的站内信问题
- php如何自动变化下载链接?
<!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里面。别的你什么都没干啊。。
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>