I have a database in which I have user_id & associated_id.There can be multiple associated_id for a single user_id. Now I want to fetch all the associated_ids into a single array. I have tried this method but don't know how to get them in array.
$stmt = $this->conn->prepare("SELECT * FROM my_contacts WHERE user_id = ?");
$stmt->bind_param("s", $user_id);
if ($stmt->execute())
    {
        while ($stmt->fetch())
        {
            //what  to write here 
        }
        //echo var_dump($user);
        $stmt->close();
    }
 
     
     
     
     
     
    