<?php
session_start();
$con=mysqli_connect("localhost","root","","accting");
$query = "USE accting";
$result = mysqli_query($con,$query);
$query = "INSERT INTO document (docDate, supplierName, refNo, vatReg, vpGoods, viGoods, nvPurchases, totalAmt, book, cash, account, termsMonth, termsDay) VALUES ('{$_POST['invoiceDate']}', '{$_POST['supplierName']}', '{$_POST['refNo']}', '{$_POST['vatReg']}', '{$_POST['amtVat']}', '{$_POST['vatInput']}', '{$_POST['nonVat']}', '{$_POST['total']}', '{$_POST['bookType']}', '{$_POST['cash']}', '{$_POST['account']}', '{$_POST['termsMonths']}', '{$_POST['termsDays']}',)";
$result = mysqli_query($con, $query);
echo "Add document successful.";
?>
不管有没有这个$query = "USE accting";
命令,尽管页面打印添加文档成功,条目仍然没有添加到数据库中。这里有什么问题?