rdkd1970 Posted June 10, 2011 Share Posted June 10, 2011 I am trying to click on another members profile and view theirs with the add as friend or remove as friend links but it keeps coming back to my own profile. I believe it is because of the $_SESSION[sESS_ID] I have in the $sqlArray. What am I suppose to use to get the other members profile when I click on it. $friendLink = ""; $the_bless_form = ""; $iFriend_array = ""; if (isset($_SESSION['SESS_ID']) && $_SESSION['SESS_ID'] != $id) { // If SESSION id :-\ is set, AND it does not equal the profile owner's ID // SQL Query the friend array for the logged in viewer of this profile if not the owner $sqlArray = mysql_query("SELECT friend_array FROM myMembers WHERE id='" . $_SESSION['SESS_ID'] ."' LIMIT 1"); while($row=mysql_fetch_array($sqlArray)) { $iFriend_array = $row["friend_array"]; } $iFriend_array = explode(",", $iFriend_array); if (in_array($id, $iFriend_array)) { $friendLink = '<a href="#" onclick="return false" onmousedown="javascript:toggleInteractContainers(\'remove_friend\');">Remove Friend</a>'; } else { $friendLink = '<a href="#" onclick="return false" onmousedown="javascript:toggleInteractContainers(\'add_friend\');">Add as Friend</a>'; } Quote Link to comment https://forums.phpfreaks.com/topic/238992-can-not-add-friend-when-i-click-on-another-profile/ Share on other sites More sharing options...
Benefitz Posted June 10, 2011 Share Posted June 10, 2011 hmmm... i suggest doing an echo on the $_SESSION['SESS_ID'] and $id, just to ensure they contain values that are strings and nothing more. I hope this helps you. -Fitz Quote Link to comment https://forums.phpfreaks.com/topic/238992-can-not-add-friend-when-i-click-on-another-profile/#findComment-1228012 Share on other sites More sharing options...
rdkd1970 Posted June 10, 2011 Author Share Posted June 10, 2011 I tried this code but it gets an error in Dreamweaver before I even try it. Is there another way to echo echo ("'.$_SESSION['SESS_ID'].'&&'.$id.'"); Quote Link to comment https://forums.phpfreaks.com/topic/238992-can-not-add-friend-when-i-click-on-another-profile/#findComment-1228020 Share on other sites More sharing options...
Ollifi Posted June 10, 2011 Share Posted June 10, 2011 It should be just ok. Or try this: print $_SESSION['SESS_ID']; print"<br>"; print $id; Quote Link to comment https://forums.phpfreaks.com/topic/238992-can-not-add-friend-when-i-click-on-another-profile/#findComment-1228022 Share on other sites More sharing options...
wildteen88 Posted June 10, 2011 Share Posted June 10, 2011 You haven't constructed the string correctly. You don't need the "'. and .'" Correct code echo 'sess_id is: ' . $_SESSION['SESS_ID'].'<br />id is: '.$id; Quote Link to comment https://forums.phpfreaks.com/topic/238992-can-not-add-friend-when-i-click-on-another-profile/#findComment-1228024 Share on other sites More sharing options...
rdkd1970 Posted June 10, 2011 Author Share Posted June 10, 2011 Nothing echos I must have the wrong $sql. I am not sure what is happening now. But that line is suppose to click on the other profile but it keeps going back to my profile. Quote Link to comment https://forums.phpfreaks.com/topic/238992-can-not-add-friend-when-i-click-on-another-profile/#findComment-1228054 Share on other sites More sharing options...
rdkd1970 Posted June 10, 2011 Author Share Posted June 10, 2011 I have in my friend_array DB is set up for text this is what is in the $sql when I click on the other member profile to try to add them as friend. Should I have it as something else. I also have in DB the friends_request for mem1 and mem2 a,b. but i do not have the default set for this. No matter how I put it in the codes it comes back to my profile so I am wondering if this is set up wrong in the DB. Quote Link to comment https://forums.phpfreaks.com/topic/238992-can-not-add-friend-when-i-click-on-another-profile/#findComment-1228146 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.