This is less on what is the precise PHP function used, and more on the SQL statements. In this case you should be able to run just one SQL statement, e.g.,
function updatefriendrequest() {
$auto_id = $_SESSION['info']['auto_id'];
$sql = "UPDATE friend_friend SET alert_message='no'
WHERE friendid='$auto_id'
AND autoid IN (SELECT autoid FROM friend_friend
WHERE friendid='$auto_id'
AND alert_message='yes')";
executeQuery($sql);
}