管理员无法更新学生档案

currently im doing my final year project which is advising system for student. My problem is that admin cannot update a certain data of student. At my first try, it says that, admin done update student profile but when i check at the database it does not update at all. After that i change my code, it turns that the data is undefined variable and mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given.

(AdminUpdateStd.php)

<?php

include("db.php");
$StdId = $_GET['id'];
$sql="SELECT * from member where id='$StdId'";
$result=mysqli_query($db,$sql);
while($rows=mysqli_fetch_array($result)){
    
    $student_id=$rows[0];
    $student_name=$rows[3];
    $student_email=$rows[5];
    $student_address=$rows[4];
    $student_tel=$rows[6];
    $intake=$rows[7];
    $total_cred=$rows[8];
    $advisor=$rows[9];
    
}
    ?>
    
 

<form action ="AdminUpdateProcess.php" method="POST">
<div  id="reg-head"  class="headrg" align="center"><strong>Profile Student   <?php  echo  "$StdId";  ?></strong></div>
<table width="350" height="200" border="1"  align="center"  cellpadding="2"  cellspacing="0" bgcolor="#FFF">




<input type="hidden" name="student_id" value=" <?php  echo "$student_id";  ?>">

<tr  id="lg-1">
<td  class="tl-1"><div  align="left"  id="tb-name">Full Name:</div></td>
<td  class="tl-4"><?php  echo  "$student_name"; ?></td>
</tr>
<tr  id="lg-1">
<td  class="tl-1"><div  align="left"  id="tb-name">Email:</div></td>
<td  class="tl-4"><?php  echo  "$student_email"; ?></td>
</tr>
<tr  id="lg-1">
<td  class="tl-1"><div  align="left"  id="tb-name">Adress:</div></td>
<td  class="tl-4"><?php  echo  "$student_address";  ?></td>
</tr>
<tr  id="lg-1">
<td  class="tl-1"><div  align="left"  id="tb-name">Tel Number:</div></td>
<td  class="tl-4"><?php  echo  "$student_tel";  ?></td>
</tr>
<tr  id="lg-1">
<td  class="tl-1"><div  align="left"  id="tb-name">Intake:</div></td>
<td  class="tl-4"><input type="text" name="intake" <?php  echo  "$intake";  ?>></td>
</tr>
<tr  id="lg-1">
<td  class="tl-1"><div  align="left"  id="tb-name">Total Credit Hour:</div></td>
<td  class="tl-4"><input type="text" name="total_credit" <?php  echo  "$total_cred";  ?>></td>
</tr>
<tr  id="lg-1">
<td  class="tl-1"><div  align="left"  id="tb-name">Advisor:</div></td>
<td  class="tl-4"><input type="text" name="advisor_name" <?php  echo  "$advisor";  ?>></td>
</tr>
<tr  id="lg-1">
<td  class="tl-1"><div  align="left"  id="tb-name"> </div></td>
<td  class="tl-4"><input type="submit" name="Update"  <?php  echo "value='UPDATE'";  ?>></a>
 <a href="AdminViewStd.php?id=<?php echo "$StdId";?>"><button type="button">View Profile</button></a></td>
</tr>

</table>

</form>

(AdminUpdateProcess.php)

<?php
include("db.php");


    $intake=$_POST['intake'];
    $total_cred=$_POST['total_credit'];
    $advisor=$_POST['advisor_name'];

$StdId = $_POST['student_id'];
 if (isset ($_POST['Update'])) {    


$UpdateQuery ="UPDATE member SET intake =  '$intake', total_credit = '$total_cred', advisor_name =  '$advisor' WHERE student_id ='$StdId'";
$res = mysqli_query ($UpdateQuery) or die ("Could not update".mysqli_error());


 } 
 




?>

</div>