| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 659 人关注过本帖
标题:新人 帮我写下 剩下不会写了 php删除
只看楼主 加入收藏
yc4360595
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2011-3-4
结帖率:0
收藏
已结贴  问题点数:20 回复次数:4 
新人 帮我写下 剩下不会写了 php删除
<body>
<table summary="This table shows the years 2004 through 2007"border="2">
<caption>输出</caption>
<tr>
   
    <th scope="col">Id</th>
    <th scope="col">名字</th>
    <th scope="col">城市</th>
    <th scope="col">性别</th>
    <th scope="col">生日</th>
    <th scope="col">操作</th>
</tr>
<form     method="post"    action="#"    ></form>

<?php


$hostname="127.0.0.1";
$username="root";
$password="123456";
$link=mysql_connect($hostname,$username,$password);
mysql_select_db("test2");
$sql2="select * from yc1";
$result1=mysql_query($sql2);
$id=0;
$sql="delete from yc1 where=$id";
while($row=mysql_fetch_array($result1)){

?>
<tr>
    <th scope="col"><?php echo $row['id']?> </th>   
    <th scope="col"><?php echo $row['name']?> </th>
    <th scope="col"><?php echo $row['city'] ?></th>
    <th scope="col"><?php echo $row['sex'] ?></th>
    <th scope="col"><?php echo $row['birth'] ?></th>
    <th><input type="submit"    value="删除"        name="$id"/></th>

???
???
??
接下来 怎么写啊····急啊  各位大侠 帮下我
搜索更多相关主题的帖子: sql 
2011-09-16 19:04
yc4360595
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2011-3-4
收藏
得分:0 
   怎么 没人理我啊·····
光是 看的    哎········
2011-09-17 07:33
dzt0001
Rank: 13Rank: 13Rank: 13Rank: 13
等 级:蒙面侠
威 望:5
帖 子:1281
专家分:4998
注 册:2005-10-12
收藏
得分:10 
发错版块了!

----我怎能在别人的苦难面前转过脸去----
2011-09-17 08:17
gdk2006
Rank: 4
等 级:业余侠客
威 望:8
帖 子:928
专家分:270
注 册:2006-7-2
收藏
得分:10 
PHP 删除,很简单的事情啊。
@mysql_query("delete from news where id in ($P_ID)");

楼主的删除代码有问题。

程序员的悲哀如何找女朋友?
追女解决方案百度“让她着迷”!
2011-09-17 16:13
gdk2006
Rank: 4
等 级:业余侠客
威 望:8
帖 子:928
专家分:270
注 册:2006-7-2
收藏
得分:0 
<body>
<table summary="This table shows the years 2004 through 2007"border="2">
<caption>输出</caption>
<tr>
   
    <th scope="col">Id</th>
    <th scope="col">名字</th>
    <th scope="col">城市</th>
    <th scope="col">性别</th>
    <th scope="col">生日</th>
    <th scope="col">操作</th>
</tr>
<form     method="post"    action="#"    ></form>

<?php


$hostname="127.0.0.1";
$username="root";
$password="123456";
$link=mysql_connect($hostname,$username,$password);
mysql_select_db("test2");

$act=$_REQUEST["act"];
$id = intval($_REQUEST["act"]);
if($act=="del")
{
    //执行删除程序
    @mysql_query("delete from yc1 where id in ($id)");
   
    //转向到列表页面.代码自己写
   
}

$sql2="select * from yc1";
$result1=mysql_query($sql2);


while($row=mysql_fetch_array($result1)){
?>
<tr>
    <th scope="col"><?php echo $row['id']?> </th>   
    <th scope="col"><?php echo $row['name']?> </th>
    <th scope="col"><?php echo $row['city'] ?></th>
    <th scope="col"><?php echo $row['sex'] ?></th>
    <th scope="col"><?php echo $row['birth'] ?></th>
    <th><a href="?id=<?=$row['id']?>&act=del" onClick="return confirm('是否将此信息删除?\n\n请您务必确认!')">删除</a></th>

程序员的悲哀如何找女朋友?
追女解决方案百度“让她着迷”!
2011-09-17 16:16
快速回复:新人 帮我写下 剩下不会写了 php删除
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.016270 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved