So lösen Sie das Problem: Hinweis: Undefinierter Index: id in D:\phpStudy\WW\Student Management System\edit.php in Zeile 13. Hinweis: Undefinierter Index in D:\phpStudy\WW\Student Management System\edit in Zeile 18 Objekt der Klasse mysqli_result kann in .php nicht in int konvertiert werden
忆思梦始
忆思梦始 2017-11-21 16:20:04
0
6
2005

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Student Management System</title>
< ;/head>
<body>
<?php include ('menu.php');
//Link zur Datenbank
header("content-type:text/html;charset=utf8");
$conn =mysqli_connect("localhost","root","root","edu");
mysqli_set_charset($conn,"utf8");
$id=$_GET['id'];
//SQL ausführen
$ sql_select = "select * from stu where id='id'";
$stmt = mysqli_query($conn,$sql_select);
//Judge
if ($stmt > 0)
{
$stu = mysqli_fetch_assoc($ stmt); // Daten analysieren
}else{
die("No such id:{$_GET['id']}");
}
?>
<h3>Studenteninformationen ändern</h3> <form action="action.php?action=edit" method="post">
<input type="hidden" name="id" value="<?php echo $stu['id' ] ;?>">
                                                      =" <?php echo $stu['name'];?>"></td>
" " </tr>
" " " <td> Alter</td>
" <td> ;<input type="text" name="age" value="<?php echo $stu['age'];?>"></td> ;
            </tr>
             tr>
                                                                                                                                       == „Männlich“)? Männlich
                                                                                                <?php echo ($stu['sex'] == "female" )?“checked“;?>weiblich
           </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>

忆思梦始
忆思梦始

Antworte allen(3)
sunten

遇到同样问题,能修改成功就是提示:

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

phpcn_u37517

你用post 发值  用get接收 我估计不好收到 

  • Antwort 好的,了解
    忆思梦始 Autor 2017-11-23 12:26:16
phpcn_u37517

链接数据库有毛病呗

  • Antwort 数据库ok的,主要是没有获取到点击修改的id&lt;在点击修改处添加..php?id=$id{$row['id']}&gt;即可
    忆思梦始 Autor 2017-11-23 12:21:45
Neueste Downloads
Mehr>
Web-Effekte
Quellcode der Website
Website-Materialien
Frontend-Vorlage