Reputation: 65
Echo of facultyname
is showing a value but fid
is not getting value.
I want to assign value of fid
to a variable.
$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);
Upvotes: 0
Views: 1726
Reputation: 2528
change field to assoc
$finfo = mysqli_fetch_field($fid_result);
to
$finfo = mysqli_fetch_assoc($fid_result);
Read - for reference
Upvotes: 1