php留言板更新代码
<script>ec(2);</script>
$lianjie = mysql_connect("localhost","root","xiaolie") or die("连接失败");
mysql_query("set names utf8");
if($lianjie)
{
mysql_select_db("xiaolie");
if(!$_GET)
{
$xuanbiao = "select * from zhuce";
$fasong = mysql_query($xuanbiao) or die(mysql_error());
echo "
编号 |
用户名称 |
性别 |
年龄 |
注册时间 |
操作 |
";
while($nr=mysql_fetch_array($fasong))
{
echo "
".$nr["id"]." |
".$nr["name"]." |
".$nr["xingbie"]." |
".$nr["nianling"]." |
".$nr["zc_shijian"]." |
编辑 |
";
}
echo "
";
}
else
{
if(!$_POST)
{
$xianid = "select * from zhuce where id=".$_GET["id"];
$fasong = mysql_query($xianid) or die(mysql_error());
$nr = mysql_fetch_array($fasong);
?>
}
else
{
$gx = "update zhuce set name='".$_POST["name"]."',xingbie='".$_POST["xingbie"]."',nianling='".$_POST["nianling"]."',zc_shijian='".$_POST["zc_shijian"]."' where id='".$_POST["id"]."'";
$fasong = mysql_query($gx);
if($fasong){
echo "记录已经成功修改
继续修改记录";}
else{
echo "记录修改失败
返回"; }
}
}
}
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn