<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title> ;學生管理系統</title>
</head>
<body>
<?php include ('menu.php');
//連結資料庫
header("content-type:text/html;charset=utf8");
$conn=mysqli_connect("localhost","root","root","edu");
mysqli_set_charset($conn, "utf8");
$id=$_GET['id'];
//執行sql
$sql_select = "select * from stu where id='id'";
$stmt = mysqli_query($conn,$sql_select);
//判斷
if ($stmt > 0)
{
$stu = mysqli_fetch_assoc($stmt); // 解析資料
# }else{
die("沒有這個id:{$_GET['id']}");
}
?>
<h3>修改學生資料</h3>
<form action="action.php?action=edit" method="post">
<input type="hidden" name="id" value="<?php echo $stu ['id'];?>">
<table>
<tr>
<td>姓名</td>
<td><input type ="text" name="name" value="<?php echo $stu['name'];?>"></td>
</tr>
< ;
<td>年齡</td>
<td><input type="text" name="age" value="<td><input type="text" name="age" value="< ?>"></td>
</tr>
<tr>
gt;
< ;input type="radio" name="sex" value="男" <?php echo ($stu['sex'] == "男")? "checked":"";?> >男
</td>
</td>
# </td>
</td>
</td>### </td>#### </td>### 1] &s="ex =";" = = "女")? "checked":"";?> >女###</td>
</tr>
<tr>
<td<type > text" name= " class" value="<?php echo $stu['class']?>"></td>
</tr>
="index.php">回</td>
<td><input type="submit" value="修改"></tdgt; type="reset" value="重置"></td>
</tr>
</table>
</form>
< /body>
sunten2019-02-13 21:25:57
遇到相同問題,能修改成功就是提示:
Notice: Object of class mysqli_result could not be converted to int in E:\phpStudy\WWW\stu\edit.php on line 19