<?php
include 'confing.php';

if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    $user_id = $_POST['user_id'];
    $name = $_POST['name'];
    $email = $_POST['email'];
    $phone = $_POST['phone'];
    $password = $_POST['password'];
    $pincode = $_POST['pincode'];
    $city = $_POST['city'];

    $query = "UPDATE vender SET 
              name='$name', email='$email', phone='$phone', password='$password', 
              pincode='$pincode', city='$city'
              WHERE id='$user_id'";

    if (mysqli_query($conn, $query)) {
        echo json_encode(["status" => "success", "message" => "Profile updated successfully"]);
    } else {
        echo json_encode(["status" => "error", "message" => "Failed to update profile"]);
    }
}
?>
