Hi everyone!
I have a problem updating my table named 'friend'. This is where I save my friend requests and updates it when a user accepts the request. My problem is when I accept a request, only one query updates. Separately, they work. But when I try to use the two together, it can only execute one query.
$sql = "SELECT Pk_Id FROM signup WHERE email ='$userEmail' ";
$q = mysql_query($sql,$con) or die("Unable to verify user because: " . mysql_error());
$userID = mysql_result($q,0);
$sql2 = "SELECT Pk_Id FROM signup WHERE email='$friendRequest'";
$q2 = mysql_query($sql2,$con) or die("Unable to verify user because: " . mysql_error());
$friendID = mysql_result($q2,0);
if($_POST['addFriend']){
$sql3 = ("UPDATE friend SET isActive=1 WHERE userEmail='$friendRequest' AND friendID='$userID'");
if (!mysql_query($sql3,$con)){
die('Error: ' . mysql_error());
} else{}
$sql4 = ("UPDATE friend SET isActive=1 WHERE userEmail='$userEmail' AND friendID='$friendID'");
if (!mysql_query($sql4,$con)){
die('Error: ' . mysql_error());
} else{}
}