suchen

Heim  >  Fragen und Antworten  >  Hauptteil

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

<!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>

忆思梦始忆思梦始2563 Tage vor1992

Antworte allen(6)Ich werde antworten

  • sunten

    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

    Antwort
    0
  • phpcn_u37517

    phpcn_u375172017-11-23 12:23:46

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

    Antwort
    0
  • 忆思梦始

    好的,了解

    忆思梦始 · 2017-11-23 12:26:16
  • phpcn_u37517

    phpcn_u375172017-11-22 17:57:52

    链接数据库有毛病呗

    Antwort
    0
  • 忆思梦始

    数据库ok的,主要是没有获取到点击修改的id<在点击修改处添加..php?id=$id{$row['id']}>即可

    忆思梦始 · 2017-11-23 12:21:45
  • StornierenAntwort