I'm new in php function is it possible to use mysqli_fetch_assoc in php function?
here's what I'm doing.
function.php
<?php
function getinfoid($conn,$idapplicant){
$sql = "SELECT * FROM applicants WHERE id_mis = '".$idapplicant."' ";
$result = mysqli_query($conn,$sql);
while ($row = mysqli_fetch_assoc($result)) {
$prefix=$row['prefix'];
$fname1=$row['fname'];
$mname1=$row['mname'];
$lname1=$row['lname'];
$gender=$row['gender'];
$addr=$row['addr'];
}
}
?>
view.php
<?php
require('connection.php');
include ('function.php');
getinfoid($conn,'2');
?>
I'm <?php echo $fname1 ?>
how is it possible to echo $fname1 ?