Log in

View Full Version : Resolved php not deleting from table?



liamallan
04-12-2010, 06:58 PM
i have installed a friends system on my site, and when a user sends a friend request, it will be accepted, and upon acceptance it should be deleted from mysql table 'friend_requests'. this doesnt happen though and just tells the user that they have another request from that same user who originally sent the request.

any ideas?

this is the accept case:

case 'accept': //accept page
if ($_GET[user]) { //get username

$add = mysql_query( "INSERT INTO `friends` (`friendname` , `username`) VALUES ('$_GET[user]' , '$session->username') "); // add to your friends list
$add2 = mysql_query( "INSERT INTO `friends` (`friendname` , `username`) VALUES ('$session->username' , '$_GET[user]') "); // fix friend bug
$delete = mysql_query( "DELETE FROM `friend_requests` WHERE `by` = '$_GET[user]'"); // deletes friend request
echo ( "$_GET[user] has been added as a friend! [<a href='userinfo.php?user=$reqs[by]' target='blank'>View Profile</a>] [<a href='newfriends.php'>More Requests?</a>] [<a href='index.php'>Home</a>]" ); // echos the completion
}
break; //ends accept page

liamallan
04-12-2010, 07:10 PM
its ok guys, i got it sorted