Please how to solve this: Note: Undefined index: id in D:\phpStudy\WW\Student Management System\edit.php on line 13 Note: Undefined index in D:\phpStudy\WW\Student Management System\edit on line 18 Cannot convert object of class mysqli_result to int in .php
忆思梦始
忆思梦始 2017-11-21 16:20:04
0
6
1998

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title> ;Student Management System</title>
</head>
<body>
<?php include ('menu.php');
//Link database
header("content-type:text/html;charset=utf8");
$conn=mysqli_connect("localhost","root","root","edu");
mysqli_set_charset($conn, "utf8");
$id=$_GET['id'];
//Execute sql
$sql_select = "select * from stu where id='id'";
$stmt = mysqli_query($conn,$sql_select);
//Judgment
if ($stmt > 0)
{
$stu = mysqli_fetch_assoc($stmt); // Parse data
}else{
die("No such id:{$_GET['id']}");
}
?>
<h3>Modify student information</h3>
<form action="action.php?action=edit" method="post">
<input type="hidden" name="id" value="<?php echo $stu ['id'];?>">
                                                          ="text" name="name" value="<?php echo $stu['name'];?>"></td>
              </tr>
                   ;
                                                                                               ?>"></td>
                                                                            < ;input type="radio" name="sex" value="Male" <?php echo ($stu['sex'] == "Male")? "checked":"";?> >Male
                                                                                                                                                   = "female")? "checked":"";?> >female
           </td>
       </tr>
       <tr>
           <td>班级</td>
           <td><input type="text" name="class" value="<?php echo $stu['class']?>"></td>
       </tr>
       <tr>
           <td a href="index.php">返回</td>
           <td><input type="submit" value="修改"></td>
           <td><input type="reset" value="重置"></td>
       </tr>
   </table>
</form>
</body>
</html>

忆思梦始
忆思梦始

reply all(3)
sunten

Encountered the same problem, if the modification is successful, the prompt is:

Notice: Object of class mysqli_result could not be converted to int in E:\phpStudy\WWW\stu\edit.php on line 19

phpcn_u37517

You use post to send the value and use get to receive it. I guess it’s hard to receive it.

  • reply Ok, I understand
    忆思梦始 author 2017-11-23 12:26:16
phpcn_u37517

There is something wrong with the link database

  • reply The database is ok, mainly because the id that you click to modify is not obtained&lt;Add ..php?id=$id{$row['id']}&gt; where you click to modify.
    忆思梦始 author 2017-11-23 12:21:45
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template