On a page that lists all my members, I'm trying to create the hyperlinks to display a member profile when clicking on their image.
The problem I'm running into is that, while the hyperlink displays correctly in the browser with the correct $profile_id, the destination only directs me to my own profile & not to the member I am trying to view.
So, it's correctly displaying each id like this, for example:
www.mywebsite.com/member_profile.php?profile_id=1
www.mywebsite.com/member_profile.php?profile_id=2
www.mywebsite.com/member_profile.php?profile_id=3
But it only directs to the logged in users profile.
I'm not sure if this is an isssue where I need to define something or pass a variable on a member profile script, or something that needs to be queried in the login script, or if I'm lacking something within my member_list.php script.
member_list.php
<?php
// Connect to database
include_once "includes/scripts/connect_to_mysql.php";
// Retrieve the user data from MySQL
$query = "SELECT user_id, firstname, lastname, username FROM member_profile WHERE email_activated='1' ORDER BY sign_up_date DESC LIMIT 20";
$result = mysql_query($query) or die(mysql_error());
$new_member_list = "";
while($row = mysql_fetch_array($result)){
$profile_id = $row["user_id"];
$user_id = $row["user_id"];
$username = $row["username"];
$firstname = $row["firstname"];
$lastname = $row["lastname"];
$check_pic = "members/".$username."/image01.jpg";
$default_pic = "members/default_user/image01.jpg";
if (file_exists($check_pic)) {
$user_pic = "<a href=\"member_profile.php?profile_id=$profile_id\" target=\"_blank\"><img src=\"$check_pic\" width=\"100px\" /></a>"; // forces picture to be 100px wide and no more
} else {
$user_pic = "<a href=\"member_profile.php?profile_id=$profile_id\" target=\"_blank\"><img src=\"$default_pic\" width=\"100px\" /></a>"; // forces default picture to be 100px wide and no more
}
$new_member_list .= '
<table class="formDetails">
<tr class="formDetails">
<td class="formField" align="left">'.$user_pic.'</td>
<td class="formDetails" align="left"><p class="eventform">'."$firstname". ' ' ."$lastname".'</p></td>
</tr>
</table>
';
} //END WHILE LOOP
?>