if ($headmod != "friends/$user_id") {
$frends = mysql_query("SELECT * FROM `friends` WHERE `user_id` = '$user_id' AND `option`");
$frends = mysql_fetch_array($frends);
$new_frends = mysql_result(mysql_query("SELECT COUNT(*) FROM `friends` WHERE `user_id` = '$user_id' AND `option`IN(1, 2)"), 0);
if ($new_frends) $list[] = '<a href="' . $set['homeurl'] . '/users/friends.php?act=new' . ($frends['option'] == '2' ? '&mod=delete' : '') . '">add</a> (+ ' . $new_frends . ')';
}
on profile i have
now ive tried 1 2 and 3 in the value where it is selected on the dbase but on profiles it says delete instead of add any input will be appreciated as making something new
$frends = mysql_query("SELECT * FROM `friends` WHERE `user_id` = '$user_id' AND `option`");
$frends = mysql_fetch_array($frends);
$new_frends = mysql_result(mysql_query("SELECT COUNT(*) FROM `friends` WHERE `user_id` = '$user_id' AND `option`IN(1, 2)"), 0);
if ($new_frends) $list[] = '<a href="' . $set['homeurl'] . '/users/friends.php?act=new' . ($frends['option'] == '2' ? '&mod=delete' : '') . '">add</a> (+ ' . $new_frends . ')';
}
on profile i have
PHP Code:
$friends = mysql_result(mysql_query("SELECT COUNT(*) FROM `friends` WHERE `friends`='1' AND (`friend_id`='" . $user['id'] . "' AND `user_id`='$user_id') OR (`friend_id`='$user_id' AND `user_id`='" . $user['id'] . "')"), 0);
if ($friends){
echo '<a href="friends.php?act=add&user=' . $user['id'] . '">Add Friend</a>';
}
else {
echo '<a href="friends.php?act=del&user=' . $user['id'] . '">Delete Friend</a>';
}
Comment