I have used a lot of function in my website projects. I had used mysql. now I want to convert it into mysqli but the problem I am facing is with mysql_result my fuction should return 1 valve only
// $mysqli is my database connection
function test($id){
$query = "SELECT name FROM members where id= '$id'";
$result = mysqli_query($mysqli, $query);
$row = mysqli_fetch_array($result, MYSQLI_ASSOC);
return $row;
}
$name = test(4);
echo $name;
when I do not use functions, just echo $row it gives correct result when I put $id =4;
return $row['name'];