ok for some reason its still not functioning
here is the link I am using:
<a href=profile.php?friend=approve>approve</a>
and here is the coding
$sql = "SELECT * FROM friends WHERE userid_1='$userid' AND status='1'";
$r = mysql_query($sql);
while ($arr = mysql_fetch_array($r)) {
$friend1 = $arr['userid_2'];
$indexvar = $arr['index'];
$sql = "SELECT * FROM users WHERE userid='$friend1'";
$r = mysql_query($sql);
while ($arr = mysql_fetch_array($r)) {
$username1 = $arr['username'];
echo "<tr><td width=150><a href=viewprofile.php?id=$friend1>$username1</a></td>\n";
echo "<td class=text align=right>[ <a href=profile.php?friend=approve>approve</a> ]</td>\n";
echo "<td class=text align=right>[ <a href=profile.php?friend=deny>deny</a> ]</td></tr>\n";
}
}
if ($_GET['friend'] == "approve") {
$sql = "UPDATE friends SET status = '2' WHERE index = '$indexvar'";
$r = mysql_query($sql);
}
else if ($_GET['friend'] == "deny") {
$sql = "DELETE FROM friends WHERE index = '$indexvar'";
$r = mysql_query($sql);
}
else {}
If you know what could possibly be wrong please tell me