I have here a function which calls details from the database after log in. The problem I have is that I receive this:
Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given in ...
Would you please point out to me what needs to be changed and how so that I would be able to get the data i needed from the database?
function profile(){
include "config.php";
$conn = mysqli_connect($host,$user,$pass,$db);
//check
if( mysqli_connect_errno($conn) ){
    echo "Error in DB";
}else{
    //connected
}
//prepare
$sql = "SELECT * FROM accounts where username='" . $_SESSION['username'] . "'";
//display 
$result = mysqli_query($conn,$sql);
$myrow=mysqli_fetch_array($result) ){ // --->the warning is from this line
        do{
            $info= array();
            $info['firstName'] = $myrow['firstName'];
            $info['middleInitial'] = $myrow['middleInitial'];
            $info['lastName'] = $myrow['lastName'];
            $info['mobile_no'] = $myrow['mobile_no'];
            $info['email_address'] = $myrow['email_address'];
            $info['registration_date'] = $myrow['registration_date'];
            $account[] = $info;
        }while($myrow=mysqli_fetch_array($result));
    }
    return $account;
}
 
     
     
     
    