You have to pass (for example) an id
to the script.
profile.php?id=456
where 456
is the user id of the user you want to open the profile.
You can then do in the profile.php something like
$st = $db->prepare('SELECT * FROM profiles WHERE user_id = ?');
$st->execute(array($_GET['id']));
and receive the information to output.
The information in $_SESSION
should only be used for the current user. Meaning if you have a script my_profile.php
you do not need to pass an id, since you can get the current logged in user-id from $_SESSION
.