I am making a website where after you have logged in and added all your contacts in the database you can also edit them. The way to go is the MYSQL UPDATE statement. I have written the code but sosmething does not seem to work and has been torturing me for hours. Here is the code
<?php
session_start();
    $del_id = $_GET["id"];
    $_SESSION["id"] = $del_id;
    $del_name = $_GET["name"];
    $del_phone = $_GET["phone"];
    $del_address = $_GET["address"];
    $del_email = $_GET["email"];
    $name2 = $_POST["name"];
    $address2 = $_POST["address"];
    $number2 = $_POST["number"];
    $email2 = $_POST["email"];
    $query = "UPDATE `contacts` SET email = '$email2' AND phone = '$number2' AND address = '$address2' AND name = '$name2' WHERE id = '$del_id'";
    $conn  = mysqli_connect($servername,$username,$password,$dbname);
    if(!$conn){
        die("Connection failed: ".mysqli_connect_error());
    }else{
        echo "Connected successfully";
    }  
    if(mysqli_query($conn,$query)){
        echo "Contact edited";    
    }
?>
<html><head></head>
    <body>
   <form action="edit.php" method = "POST">
      Add text only to the ones you want changed:<br><br>
        NAME<input type="text" value="<?php echo $del_name?>" name="name"><br>        
        ADDRESS<input type="text" value="<?php echo $del_address?>" name="address"><br>  
        PHONE NUMBER <input type="text" value="<?php echo $del_phone ?>" name="number"><br>  
        EMAIL <input type="text" value="<?php echo $del_email ?>" name="email"><br>  
      <input type="submit" value="Submit">
    </form>
    </body>
</html>
What could be the problem because the contact in the database is not being updated after that?
 
     
    