본문 바로가기
MySql

MySQL 해결 방법 알림 : 정의되지 않은 색인 : 21 행의 C : \ xampp \ htdocs \ invmgt \ manufactured_goods \ change.php의 id

by 베이스 공부 2020. 11. 29.
반응형

"주의 : 정의되지 않은 인덱스"라는 PHP 코드에 문제가 있습니다. 저는 초보자이기 때문에 정확히 무엇이 잘못되었는지 잘 알지 못하므로 제발 도와주세요.

다음은 코드입니다.

<?php require_once('../Connections/itemconn.php'); ?>
    <?php   

    $id=$_GET['id']; 

        $query=mysql_query("select * from manuf where id='$id' ")or die(mysql_error());
        $row=mysql_fetch_array($query);

        ?>

<form action="updateprice.php" method="post" enctype="multipart/form-data">
  <table align="center">
   <tr>
   <td> <label><strong>Item Name</strong></label></td>
     <td> <label> <?php echo $row['itemname']; ?></label><input type="hidden" name="id" value="<?php echo $id; ?> " />
     <br /></td>
    </tr>
    <tr>

     <td><label><strong>Unit price </strong></label></td>
  <td> <input type="text" name="pass" value="<?php echo $row['unitprice']; ?> " /><br /></td>
  </tr>

    <tr>
  <td> 
          <input type="reset" name="Reset" value="CANCEL" />
      <br></td>


     <td> 
          <input type="submit" name="Submit2" value="Update" />      </td>
   </tr>
</table>
</form>
</body>
</html>

 

해결 방법

 

$ id = $ _ GET [ 'id']; 의 값을 얻지 못했습니다.

그리고 당신은 그것을 사용하고 있습니다 (초기화되기 전에).


따라서 줄을 다음과 같이 업데이트하십시오.

$id = isset($_GET['id']) ? $_GET['id'] : '';

 

참조 페이지 https://stackoverflow.com/questions/26670444

 

 

반응형

댓글