Jump to content

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


kernelgpf

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.