In an application that I am building, I need to display different kinds of buttons for users with different designations (HOD, Director or Staff). Consider the code snippet-
<button id="request">Leave Request</button>
<button id="statistics">Leave Statistics</button>
<?php
$sql = "SELECT Role from employee where `Emp Code`=$emp_code";
$result = mysqli_query($link,$sql);
$row =mysqli_fetch_array($result, MYSQLI_NUM);
if($row[0] == "HOD"){
echo "<button id='new'> New Button</button>";
}
So is the logged in used is a HOD then he/she should see 3 buttons.
Error displaying- Couldn't fetch query. Parameter 1 in mysqli_fetch_array should be mysqli_result, none given.