ok

Mini Shell

Direktori : /proc/thread-self/root/proc/self/root/home2/selectio/www/vijay-gases/apis/
Upload File :
Current File : //proc/thread-self/root/proc/self/root/home2/selectio/www/vijay-gases/apis/sale-add-api.php

<?php 
ob_start();
session_start();
include "../config/config.php";
$session_id = $_SESSION['vijay_gases']['id'];


// Product Details Create, Update Starts Here 

if(isset($_POST['type']) && $_POST['type'] == 'add_new_purchase') {
    
    try {
       $product_ids = $_POST['product_id'];
        error_log($data);
        $statement1 = $pdo->prepare("UPDATE `tbl_product` SET product_type = 2 WHERE id = $product_ids");
        $result1 = $statement1->execute();
        
        if($result1) {    
            $return_arr['message'] = 'Purchase Cylinder Added Successfully...';
            $return_arr['status'] = 200;
        } else {
            $return_arr['message'] = 'Something Wrong..';
            $return_arr['status'] = 400;
        }
         
    } catch(PDOException $e) {
        $return_arr['message'] = $e->getMessage(); // Use getMessage() to get the error message
        $return_arr['status'] = 500;
    }   
    echo json_encode($return_arr);
}


if(isset($_POST['type']) && $_POST['type']=='update_product'){
     try{
       
        
         $statement = $pdo->prepare("UPDATE `tbl_product` SET `product_name`=?,`sku`=?,`purchase_price`=?,`sell_price`=?,`default_purchase_location`=?,`current_stock`=?, `status`=? WHERE id=?");
         $result = $statement->execute(array($_POST['product_name'],$_POST['sku_no'],$_POST['purchase_price'],$_POST['sell_price'],$_POST['location'],$_POST['stock'],$_POST['status'],$_POST['ids']));
        
        if($result){    
            $return_arr['message']='Product Details Updated Successfully...';
            $return_arr['status']=200;
        } 
        else{
            $return_arr['message']='Something Went Wrong..';
            $return_arr['status']=400;
        }
         
    }catch(PDOException $e){
        $return_arr['message']="$e";
        $return_arr['status']=500;
        }   
    echo json_encode($return_arr);
}



// Product Details Create, Update Ends Here
?>

Zerion Mini Shell 1.0