0

please help me with this code i m trying to update so it only delete and leave empty i have spend more time doing this and researched on google but there was no success. please anyone help out.

try{

    $query = "UPDATE users 

                SET mobile=:pmobile, bank=:pbank, account=:paccount 

                WHERE user_id = :user_id";

    $stmt = $DB_con->prepare($query);

    $mobile=htmlspecialchars(strip_tags($_POST['pmobile']));

    $bank=htmlspecialchars(strip_tags($_POST['pbank']));

    $account=htmlspecialchars(strip_tags($_POST['paccount']));

    $stmt->bindParam(':pmobile', $pmobile);

    $stmt->bindParam(':pbank', $pbank);

    $stmt->bindParam(':paccount', $paccount);

    $stmt->bindParam(':user_id', $user_id);         

    if($stmt->execute()){

        echo "<div class='alert alert-success'>Record was updated.</div>";

    }else{

        echo "<div class='alert alert-danger'>Unable to update record. Please try again.</div>";

    } 

}

catch(PDOException $exception){

    die('ERROR: ' . $exception->getMessage());

}

thanks ii advance

Relexk
  • 29
  • 1

0 Answers0