What im trying to do is basically add users to a table favourite users if it already dont exist which works fine, if its already added to the table then it shows remover from favourite, but when i actually click the link its not workin as expected... at first it deleted the fav user no matter no matter wha username your using, so ive added $favourite into DELETE $favourite FROM which should work fine but im getting this error
Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''si' FROM favourite_members WHERE username='aaaa'' at line 1
CODE:
<?php
session_start();
if(isset($_SESSION['username'])){
$con = mysql_connect("CONNECTION HERE");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("DATABASE HERE", $con);
$username=$SESSION['username'];
$favourite=$GET['username'];
$sql="DELETE '$favourite' FROM favourite_members WHERE username='$username'";
if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
header("location:/user_blogs.php?username=$favourite");
mysql_close($con);
}else{echo"You must sign in to remove a user from favourites"; }
?>