facultyname的回显显示值,但fid没有得到值。
我想将fid的值分配给变量。

$facultyname=$_POST['facultyname'];
echo $facultyname;

$query="SELECT fid FROM faculty WHERE fname='$facultyname'";
$fid_result=mysqli_query ($link,$query);
$finfo = mysqli_fetch_field($fid_result);
 printf("FacultyID :- %d     ",$finfo->fid);

最佳答案

将字段更改为assoc

 $finfo = mysqli_fetch_field($fid_result);




$finfo = mysqli_fetch_assoc($fid_result);


阅读-供参考


  Fetch field
  
  Fetch Assoc

关于php - mysqli_result值转换为php中的变量,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/30886352/

10-13 00:54