Mini Shell

Direktori : /var/www/vhosts/ccp.ac.th/smtp.ccp.ac.th/httpdocs/new/sp/admin_gard_new/
Upload File :
Current File : /var/www/vhosts/ccp.ac.th/smtp.ccp.ac.th/httpdocs/new/sp/admin_gard_new/insert_subject.php

<?php
    include '../db/database.php'; 
    $year = $_POST['year'];
    $subject_code = $_POST['subject_code'];
    $subject_name = $_POST['subject_name'];
    $credit = $_POST['credit'];
    $subject_class_id = $_POST['subject_class_id'];
    $course = $_POST['course'];
   
  
    
    $sql = "INSERT INTO `subject` (`subject_class_id`,`subject_name`,`credit`,`subject_code`,`academic_year`,`course`) VALUES 
          ('$subject_class_id','$subject_name','$credit','$subject_code','$year','$course')";
    $result = mysqli_query($link2, $sql);
    
    if ($result) {
        header('Content-Type: application/json');
        echo json_encode(array('status' => 'success','message' => 'บันทึกข้อมูลเรียบร้อยแล้ว'));
    } else {
        header('Content-Type: application/json');
        $errors = "เกิดข้อผิดผลาดไม่สามารถบันทึกข้อมูลได้" . mysqli_error($link);
        echo json_encode(array('status' => 'danger','message' => $errors));
    }

Zerion Mini Shell 1.0