会话php的配置文件

recently I've added a search feature to find users through my database and I encountered a question upon selecting the searched user:

-Example: John Doe searches for a user; John Doe then clicks the link to go to the users profile (view_profile.php). -Should I be echoing out all the info I want to display about the searched user via using mysql_fetch_array($username) and storing all desired info in session variables?

Should I be passing session variables to create profiles for other users to view. Or should every profile have it's own file? Thanks.

Set the Link that comes up when a user is searched to:

<a href="view_profile.php?userId=*put user id here*">*put user name here*</a>

When the User clickes the link, PHP should get the users row from the database with:

$_GET['userId'];

SQL Query:

SELECT * FROM users WHERE id = *put user id here*

Don't use $_SESSION variables for this. Hope this helped you out.