我可以将数据插入本地主机上的数据库,但是当我将其放在Web服务器上时,它将无法工作。我尝试添加php错误检查,但没有任何显示。我还打开了ini文件中的php错误检查,但它仍然为空。如何检查错误?
post.php
<?php {
$servername = "localhost";
$username = "meherghl";
$password = "Topper";
$dbname = "meherghl";
try {
$conn = new PDO("mysql:host=$servername;dbname=$dbname", $username, $password);
// set the PDO error mode to exception
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
// prepare sql and bind parameters
$stmt = $conn->prepare("INSERT INTO cwb_coins (id, profileid, store, position,
nickname, contactnumber, machinecount, cutoffdate, coins, location, lastsubmission, rank, currentprize, leasestartdate, leasedaysremaining, monthlyrent, prepaymentamount, securitydeposit, paymentmethod, leaseenddate, leasenoticedate, prepaymentmonths, amountpaid, paymentoutstanding)
VALUES (:id,:profileid,:store,:position, :nickname,:contactnumber,:machinecount,:cutoffdate, :coins,:location,:lastsubmission,:rank,:currentprize,:leasestartdate,:leasedaysremaining,:monthlyrent,:prepaymentamount,:securitydeposit,:paymentmethod,:leaseenddate,:leasenoticedate,:prepaymentmonths,:amountpaid,:paymentoutstanding)");
$stmt->bindParam(':id', $_POST['id']);
$stmt->bindParam(':profileid', $_POST['profileid']);
$stmt->bindParam(':store', $_POST['store']);
$stmt->bindParam(':position', $_POST['position']);
$stmt->bindParam(':nickname', $_POST['nickname']);
$stmt->bindParam(':contactnumber', $_POST['contactnumber']);
$stmt->bindParam(':machinecount', $_POST['machinecount']);
$stmt->bindParam(':cutoffdate', $_POST['cutoffdate']);
$stmt->bindParam(':coins', $_POST['coins']);
$stmt->bindParam(':location', $_POST['location']);
$stmt->bindParam(':lastsubmission', $_POST['lastsubmission']);
$stmt->bindParam(':rank', $_POST['rank']);
$stmt->bindParam(':currentprize', $_POST['currentprize']);
$stmt->bindParam(':leasestartdate', $_POST['leasestartdate']);
$stmt->bindParam(':leasedaysremaining', $_POST['leasedaysremaining']);
$stmt->bindParam(':monthlyrent', $_POST['monthlyrent']);
$stmt->bindParam(':prepaymentamount', $_POST['prepaymentamount']);
$stmt->bindParam(':securitydeposit', $_POST['securitydeposit']);
$stmt->bindParam(':paymentmethod', $_POST['paymentmethod']);
$stmt->bindParam(':leaseenddate', $_POST['leaseenddate']);
$stmt->bindParam(':leasenoticedate', $_POST['leasenoticedate']);
$stmt->bindParam(':prepaymentmonths', $_POST['prepaymentmonths']);
$stmt->bindParam(':amountpaid', $_POST['amountpaid']);
$stmt->bindParam(':paymentoutstanding', $_POST['paymentoutstanding']);
$stmt->execute();
}
catch(PDOException $e)
{
}
$conn = null;
}
?>