Jump to content

[SOLVED] Delete query not working, though....


Recommended Posts

I'm trying to make it so people can remove friends from their friendlist, but the query won't work. Both variables are set, query works if I put it in the SQL box in phpmyadmin.. here's my code.

[code]
<?php
include "header.php"; //DB connection
if($_GET['action'] == "removefriend"){
$pid=$_GET['playerid'];

mysql_query("DELETE FROM `friendslist` WHERE `playerid`='$pid' AND `friendof`='$sid'");

echo "$sql";

print "<p>Successfully removed friend.<p>";

}



$query=mysql_query("select playerid,note,friendid from friendslist where friendof='$sid'");
$num=mysql_num_rows($query);
if($num == "0"){
print "No friends? What a shame. Get out there a socialize!";
include "footer.php";
exit;
}
else{
print "You have <b>$num</b> friends.<p>";
}
print "<table border=2><th width=100>Friend</th><th width=300>Note</th><th width=200>Remove?</th>";
for($i=0;$i<$num;$i++){
$row=mysql_fetch_array($query);
$query2=mysql_query("select basicname from users where id='$row[playerid]'");
$row2=mysql_fetch_array($query2);
print "<tr><td class=tstyle3><a href='/userprofiles.php?id=$row[playerid]'>$row2[basicname]</a></td><td class=tstyle3>$row[note]</td><td class=tstyle3> <a href='friendlist.php?action=removefriend&playerid=$row[friendid]'>[x] remove</a></td></tr>";
}
include "footer.php";
?>[/code]
Link to comment
https://forums.phpfreaks.com/topic/35379-solved-delete-query-not-working-though/
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.