stewart715 Posted October 31, 2006 Share Posted October 31, 2006 I'm trying to return a certain template based on two data tables and I thought I did the following correctly but apparently i didn't..anyone see anything?[code]<?phpfunction phptemplate_user_profile($user, $fields = array()) {$userid = $user->uid;$link = mysql_connect("localhost","thepdcom_popnew","password);mysql_select_db("thepdcom_popnew",$link);$query = mysql_query("SELECT privacyid FROM privacymode WHERE uid = '$user->uid'"); $result = mysql_fetch_object($query);//if profile is privateif ($result =1) {//if user is friend if (@in_array($user->uid, array_keys(buddylist_get_buddies($account->uid))) && user_access('maintain buddy list')) {return _phptemplate_callback('user_profile', array('user' => $user, 'fields' => $fields)); }//if user is not friend else if ($account->uid != $user->uid && user_access('maintain buddy list')) {return _phptemplate_callback('private_profile', array('user' => $user, 'fields' => $fields));--------------------------------//if profile is public } else if ($result =2) {return _phptemplate_callback('user_profile', array('user' => $user, 'fields' => $fields)); }//if nothing was selected else if ($result = NULL) {return _phptemplate_callback('user_profile', array('user' => $user, 'fields' => $fields)); }}}?>[/code] Quote Link to comment Share on other sites More sharing options...
btherl Posted October 31, 2006 Share Posted October 31, 2006 I assume the missing quote is because you edited the password.One problem is here:[code]if ($result = 1)[/code]That will assign the value 1 to $result. Instead you should use[code]if ($result == 1)[/code]Also, since $result is a mysql row object, you should use:[code]if ($result->privacyid == 1)[/code] Quote Link to comment 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.