Jump to content

Help! I've tried this everyway and I can't get it


stewart715

Recommended Posts

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]<?php
function 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 private
if ($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]
Link to comment
Share on other sites

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]

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.