求解答,为什么我的UPDATE修改数据库实现不了啊???但是提示修改成功了的!!
<?phpinclude("text_conn.php");include("text_top.php");if(@$_POST["submit"]){$id=@$_PO...
<?php
include("text_conn.php");
include("text_top.php");
if(@$_POST["submit"]){
$id=@$_POST['id'];
$name=@$_POST['name'];
$sex=@$_POST['sex'];
$sql2="UPDATE xxcs SET name='$name',sex='$sex' where id='$id'";
mysql_query($sql2);
echo "<script language=\"javascript\">alert('修改成功');history.go(-1)</script>";//JS跳转语句
header("location:text_list.php");//PHP跳转语句
}else{
$id = @$_GET['id'];
$sql="select * from xxcs where id='$id'";
$query = mysql_query($sql);
$rows=mysql_fetch_array($query);
}
?>
<form action="text_update.php" method="post">
<fieldset>
<legend>修改个人信息</legend>
序列:<input type="text" name="id" value="<?=$rows['id']?>" disabled="disabled" size="4" /><!--disable 让读出来的值无法修改-->
姓名:<input type="text" name="name" value="<?=$rows['name']?>" size="10" /><br />
性别:<input type="radio" name="sex" value="男" <?php if($rows['sex']=='男'){echo 'checked=checked';}else{echo '';}?> />男
<input type="radio" name="sex" value="女" <?php if($rows['sex']=='女'){echo 'checked=checked';}else{echo '';}?> />女
<input type="submit" name="submit" value="确认修改" />
</fieldset>
</form> 展开
include("text_conn.php");
include("text_top.php");
if(@$_POST["submit"]){
$id=@$_POST['id'];
$name=@$_POST['name'];
$sex=@$_POST['sex'];
$sql2="UPDATE xxcs SET name='$name',sex='$sex' where id='$id'";
mysql_query($sql2);
echo "<script language=\"javascript\">alert('修改成功');history.go(-1)</script>";//JS跳转语句
header("location:text_list.php");//PHP跳转语句
}else{
$id = @$_GET['id'];
$sql="select * from xxcs where id='$id'";
$query = mysql_query($sql);
$rows=mysql_fetch_array($query);
}
?>
<form action="text_update.php" method="post">
<fieldset>
<legend>修改个人信息</legend>
序列:<input type="text" name="id" value="<?=$rows['id']?>" disabled="disabled" size="4" /><!--disable 让读出来的值无法修改-->
姓名:<input type="text" name="name" value="<?=$rows['name']?>" size="10" /><br />
性别:<input type="radio" name="sex" value="男" <?php if($rows['sex']=='男'){echo 'checked=checked';}else{echo '';}?> />男
<input type="radio" name="sex" value="女" <?php if($rows['sex']=='女'){echo 'checked=checked';}else{echo '';}?> />女
<input type="submit" name="submit" value="确认修改" />
</fieldset>
</form> 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询