ok

Mini Shell

Direktori : /proc/self/root/home2/selectio/www/thedentalpark.com/admin/apis/
Upload File :
Current File : //proc/self/root/home2/selectio/www/thedentalpark.com/admin/apis/doctor.php

<?php
require_once '../config/config.php';

$id = $_POST['id'] ?? '';
$doctor_name = $_POST['doctor_name'] ?? '';
$doctor_degree = $_POST['doctor_degree'] ?? '';
$doctor_address = $_POST['doctor_address'] ?? '';
$doctor_phone = $_POST['doctor_phone'] ?? '';
$status = $_POST['status'] ?? '';

if ($id) {
    $statement = $pdo->prepare("UPDATE tbl_doctor SET doctor_name=?,doctor_degree=?,doctor_address=?,status=?,doctor_phone=? WHERE id=?");
    $result = $statement->execute([$doctor_name,$doctor_degree, $doctor_address,$status,$doctor_phone,$id]);

    if ($result) {
        echo json_encode(['status' => 200, 'message' => 'Doctor details updated successfully.']);
    } else {
        echo json_encode(['status' => 500, 'message' => 'Failed to update Doctor details.']);
    }
} else {
    $statement = $pdo->prepare("INSERT INTO tbl_doctor (doctor_name, doctor_degree,doctor_address,status,doctor_phone) VALUES (?, ?, ?, ?,?)");
    $result = $statement->execute([$doctor_name,$doctor_degree,$doctor_address,$status,$doctor_phone]);

    if ($result) {
        echo json_encode(['status' => 200, 'message' => 'Doctor details added successfully.']);
    } else {
        echo json_encode(['status' => 500, 'message' => 'Failed to add Doctor details.']);
    }
}

?>

Zerion Mini Shell 1.0