我无法将php上的数据插入mysql

时间:2019-09-05 12:31:35

标签: php mysql bootstrap-modal

我有一个作业,差不多完成了。仅此文件有问题。我无法从php输入数据库,我以为输入错误,但是在我检查后仍未找到错误

我试图更改php变量,名称属性

<?php
    // connection
    $host = "localhost";
    $user = "root";
    $pass = "";
    $db = "alamimi";
    $connect = mysql_connect($host,$user,$pass) or die("Failed");
    $pilih_db = mysql_select_db($db) or die("No databases");
    //form
    $idPesanan = $_POST['idPesanan'];
    $namaPemesan = $_POST['namaPemesan'];
    $keterangan = $_POST['keterangan'];
    $tanggalPemesanan = $_POST['tanggalpesan'];
    $deadline = $_POST['deadline'];
    $status =  "belum";
    $submit = $_POST['submit'];
    if($submit){
        mysql_query("INSERT INTO 'pesanan' ('idPesanan', 'namaPemesan', 'keterangan', 'tanggalPemesanan', 'deadline', 'statusFK') VALUES ('$idPesanan', '$namaPemesan', '$keterangan', '$tanggalPemesanan', '$deadline', '$status')");
        ?>
            <script>
                alert("Success");
                window.location.assign("index.php");
            </script>
        <?php
    }
?>

我无法插入但没有错误报告

0 个答案:

没有答案