ok

Mini Shell

Direktori : /home2/selectio/public_html/wedding-info/api/
Upload File :
Current File : /home2/selectio/public_html/wedding-info/api/religion_add.php

<?php
include_once('config/config.php');
include_once('config/custom-functions.php');
include 'config/send-sms.php';

$return_arr = array(); // Initialize the return array

if (isset($_POST['type']) && $_POST['type'] == 'upload') {
    try {
        $ids =$_POST['ids'];
        
        $cat_name = $_POST['cat_name'];
        $d_order = $_POST['d_order'];
        $sub_cat_avl = $_POST['sub_cat_avl'];
        $status = $_POST['status'];
        $new_image = $_POST['new_img_name'];
        $zodiac = $_POST['zodiac'];
        $new_img_name = $_POST['new_img_name'];

        // Prepare and execute the SQL statement
    $statement = $pdo->prepare("INSERT INTO `tbl_category` (`cat_name`, `status`, `add_productdetails`, `d_order`, `product_img`, `zodiac`,`sub_cat_id`) VALUES (?,?, ?, ?, ?, ?, ?)");
$result = $statement->execute([$cat_name, $status, $sub_cat_avl, $d_order, $new_img_name, $zodiac,$ids]);

        if ($result) {
            $return_arr['message'] = 'Category added successfully.';
            $return_arr['status'] = 200;
        } else {
            $return_arr['message'] = 'Something went wrong.';
            $return_arr['status'] = 400;
        }
    } catch (Exception $e) {
        $return_arr['message'] = $e->getMessage();
        $return_arr['status'] = 500;
        error_log($e->getMessage());
    }

    echo json_encode($return_arr);
}
?>

Zerion Mini Shell 1.0