Q:

changing deprecated mysql_result to mysqli

I'm changing my deprecated php code for mysql to the new mysqli, but I have problems with this one, the thing is that with the new code I get only the Name echoed, i. e. the first echo, but not the nexts (Department, Phone), from all the codes I've tried this is the closest to a good result.  Any suggestion? 
I used as a guide the code found here MySQLi equivalent of mysql_result()? 
old-code.php
<? php
include 'access.php';
$UNIS=$_GET['UNIS'];
mysql_select_db("Timetable") or die(mysql_error());

$query = "SELECT * FROM `Professors` WHERE `UNIS` = '$UNIS'";
$result = mysql_query($query) or die(mysql_error());
$num=mysql_num_rows($result);
$i=0;
while($i < $num) {
$Name=mysql_result($result,$i,"Name");
$Department=mysql_result($result,$i,"Department");
$Phone=mysql_result($result,$i,"Phone");
++$i;
}
echo "Name: $Name<br>";
echo "Department: $Department<br>";
echo "Phone: $Phone";
? >

new-code.php
<? php include 'access.php';
$UNIS=$_GET['UNIS'];
$result = mysqli_query($link, "SELECT * FROM `Professors` WHERE `UNIS` = '$UNIS'") or die(mysqli_error());
$num=mysqli_num_rows($result);
$i=0;
while($i < $num) {
$Name= $result->fetch_assoc()["Name"];
$Department= $result->fetch_assoc()["Department"];
$Phone= $result->fetch_assoc()["Phone"];
++$i;
}
echo "Name: $Name<br>";
echo "Department: $Department<br>";
echo "Phone: $Phone";
$link->close();
? >

A:

Change this
$result = mysqli_query($link, "SELECT * FROM `Professors` WHERE `UNIS` = '$UNIS'") or die(mysqli_error());

to this
$result = mysqli_query($link, "SELECT * FROM Professors WHERE UNIS = '$UNIS'") or die(mysqli_error($link));

mysqli_error() should come with connection mysqli_error($link)
PHP mysqli_error() Function
and wrong argument pass in while loop
$i=0;
while($i < $num) {

Final well formed code is
$UNIS=$_GET['UNIS'];
$result = mysqli_query($link, "SELECT * FROM Professors WHERE UNIS = '$UNIS'") or die(mysqli_error($link));
$num=mysqli_num_rows($result);
if(empty($num))
{
    echo 'Empty data';
}
else
{
    $row=mysqli_fetch_array($result,MYSQLI_ASSOC);
    echo "Name: ".$row['Name']."<br>";
    echo "Department: ".$row['Department']."<br>";
    echo "Phone: ".$row['Phone']."<br>";
}

$link->close();

