I have two table.
newuser (id,office_id,username)
offices (office_id,office_name)
When user login I got his office_id 
- I want to fetch his office_namefromofficestable
The session is working :
if(isset($_SESSION['office']))
{
    $id_office = $_SESSION['office'];
}
I wrote this code to fetch office_name but dose not work
$query =("SELECT office_name FROM offices WHERE office_id = '$id_office'");
            $result=mysqli_query($con,$query);
            if($result->num_rows > 0)
{
        $office_name = $_POST['office_name'];
}
 
     
    