ajax警报工作,但为什么不能保存到数据库

时间:2017-09-06 14:40:20

标签: php jquery mysql ajax

我有问题用ajax保存到dabatase。 如果只是ajax警报,工作 但是,如果保存到数据库,则不保存。 在代码中,我尝试回声,但没有显示结果

我有问题用ajax保存到dabatase。 如果只是ajax警报,工作 但是,如果保存到数据库,则不保存。 在代码中,我尝试回声,但没有显示结果

<script>
$(document).ready(function() {

  $("#myTable").on('click', '.btnSelect', function() {

    var currentRow=$(this).closest("tr"); 

    var col1 = currentRow.find("td:eq(0)").text();

    var col2 = currentRow.find("td:eq(1)").text();

    var col3 = currentRow.find("td:eq(2)").text();

    var col4 = currentRow.find("td:eq(3)").text();

    var col5 = currentRow.find(":selected").text();

    var col6 = currentRow.find("input[name='qtyorder[]']").val();

//    var data = col1 + "\n" + col2 + "\n" + col3 + "\n" + col4 + "\n" + col5 + "\n" + col6;

//    alert(data);

                         $.ajax({
                        type: "POST",
                        url: "b_save_data_total_resin_based_po_customer.php",
                        data: "bulanpo=" + col1+ "&supplier=" + col2"&qtypo=" + col3"&resin=" + col4"&bulanorder=" + col5"&qtyorder=" + col6,
                        success: function(data) {
                           alert("sucess");
                        }
                    });


  });

});
//*
</script>

b_save_data_total_resin_based_po_customer.php

<?php
include "session.php";
include "header.php";
include "navigasi.php";
$username = $login_session;

$bulanorder = $_GET['bulanorder'];
$qtyorder = $_GET['qtyorder'];
$today = date("Y-m-d");
$bulanpo = $_GET['bulanpo'];
$qtypo = $_GET['qtypo'];
$supplier = $_GET['supplier'];
$resin = $_GET['resin'];


       $sql="
       INSERT INTO order_resin_to_supplier (transaction_id,date_transaction,bulanpo,supplier,qtypo,resin,bulanorder,qtyorder,username,date_input) 
       VALUES ('test','$today','$bulanpo','$supplier','$qtypo','$resin','$bulanorder','$qtyorder','$username','$today')";
     //  $sql = $conn->query($sql);

    echo $sql;   
//$conn->close(); 
?>

需要帮助谢谢

0 个答案:

没有答案