當我使用這個腳本時,它得到:在這個服務器上找不到請求的URL /StockManager/Product_Submit.php。MYSQL insert給404錯誤
此外,嘗試使用ErrorDocument處理請求時遇到404未找到錯誤。
它不會輸入任何內容到MYsql數據庫中。
這是我的腳本:
<?php
include 'Connect.php';
$ProName=htmlspecialchars($_POST["ProName"]);
$ProBuyprice=htmlspecialchars($_POST["ProBuyprice"]);
$ProWooPrice=htmlspecialchars($_POST["ProductWooPrice"]);
$WooId=htmlspecialchars($_POST["WooId"]);
$ProEbayPrice=htmlspecialchars($_POST["ProductEbayPrice"]);
$EbayId=htmlspecialchars($_POST["EbayId"]);
$ProQun=htmlspecialchars($_POST["ProQun"]);
$id=htmlspecialchars($_POST["userid"]);
$sql = ("INSERT INTO SoftwProducts(userid, Name, Qun, WooId, EbayId, BuyPrice, WooSelling, ebaySelling)
VALUES ($id,$ProName,$ProQun, $WooId, $EbayId, $ProBuyprice, $ProWooPrice, $ProEbayPrice)");
if (!mysqli_query($conn,$sql))
{
die('Error: ' . mysqli_error($conn));
}
echo "Success!";
?>
當我刪除if語句,只是做:
mysqli_query($conn,$sql)
我沒有收到404錯誤。 我在做什麼錯。 在此先感謝!
404 HT TP頁面未找到錯誤,您正在將數據發佈到不存在的頁面。 –
MySQL不會給404錯誤,您的Web服務器。 PHP腳本的路徑是錯誤的。 –
我不認爲添加或刪除'if'語句可能會影響此錯誤的任何方式。編輯腳本的唯一方法可能導致或修復404,如果腳本執行重定向,並且它重定向到不存在的URL。 – Barmar