php search results that have link on them

hey people.

i have a search box that posts to my search.php page and i have it displaying UserName and userID and UserEmail according to the search term
 i am trying to add a link to go to that users profile. am not sure how to add this?
 here is a screen shot what it look like:
thank you

$query="SELECT * FROM members WHERE UserName OR UserEmail LIKE '%".$Search."%'"; 
	$result=mysql_query($query) or die ("bad query '$query' : ".mysql_error());
	if (mysql_num_rows($result)>0) {
		  while ($res=mysql_fetch_array($result)) {
		  	echo $res['UserEmail'].'<br>';	
		  	echo $res['UserName'].'<br>';	
			echo $res['MemberID'].'<br>';
		echo 'No results';

Open in new window

Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

Rik-LeggerConnect With a Mentor Commented:
Do you mean it like this?

echo '<a href="profile.php?id=' . $res['MemberID']. '">' . $res['UserName'] . '</a><br>';

Open in new window

helpchrisplzAuthor Commented:
ok so yes that will work now do i have the member id still? i see it in the browser address box. i need it in a variable to pull the searched users content in. can u explain that bit? sorry i am learning
You can retreive that with $_GET['id'],
but these are really the basics. Perhaps you should read some PHP tutorials first.
Lukasz ChmielewskiConnect With a Mentor Commented:
If you have that in your addressbar just get it with
 $userid = $_GET[id];
 // for further data use query
 $query = "SELECT * FROM members WHERE Memberid = $userid";
 $result = mysql_query($query);
 $row = mysql_fetch_array($result);
helpchrisplzAuthor Commented:
yes thank you :)
All Courses

From novice to tech pro — start learning today.