我正在尝试使用PDO
这样做来更新mysql中的一行,我不知道它为什么不执行。一切似乎都是正确的,但它不会执行,也不会产生任何错误。
首先我得到我通过发送的值$.ajax
$idRequest = $_POST['idRequest'];
$dateStarted = $_POST['dateStarted'];
$requester = $_POST['requester'];
$quantity = $_POST['quantity'];
$qaauthorization = $_POST['qaauthorization'];
$qengineer = $_POST['qengineer'];
$performer = $_POST['performer'];
$voltage = $_POST['voltage'];
$goal = $_POST['goal'];
$measurementunit = $_POST['measurementunit'];
$account = $_POST['account'];
$centercost = $_POST['centercost'];
$ela = $_POST['ela'];
$it = $_POST['it'];
$testtype = $_POST['testtype'];
$brand = $_POST['brand'];
$model = $_POST['model'];
$part = $_POST['part'];
$objective = $_POST['objective'];
$production = $_POST['production'];
$reason = $_POST['reason'];
$specifications = $_POST['specifications'];
然后我创建查询
$queryRQ = "UPDATE
request
SET
`idRequester` = ? , `idQEngineer` = ? , `RequestDate` = ? , `idModelNumber` = ?,`idPartDescription` = ? ,`idTestType` = ? , `ReasonForTesting` = ? ,
`Quantity` =?,`Goal` = ?,`idMeasurementUnit` = ?, `Voltage` = ?, `AccountNumber` = ?, `CenterCost` = ?, `ELA` = ?,`ITNumber` = ?, `idPerformer` = ?, `DateStarted` = NOW(), `DateCompleted` = NULL,
`Specifications` =?, `idObjective` = ?, `idProduction` = ?, `idBrand` = ?, `Available` = 1 , `Pending` = 0)
WHERE
idRequest = ?";
最后,当 iprepare
和execute
the$stmt
似乎什么都没有发生时,它不会产生任何错误
$reqVals = array($requester,$qengineer,$dateStarted,$model,$part,$testtype,$reason,
$quantity,$goal,$measurementunit,$voltage,$account,$centercost,$ela,$it,$performer,
$specifications,$objective,$production,$brand, /* WHERE */ $idRequest);
$stmtRQ = $pdo->prepare($queryRQ);
$stmtRQ->execute($reqVals);
我通过用以下内容包围所有内容来报告错误try - catch
:
try{
// EVERYTHING
} catch(PDOException $e){
echo(json_encode($e->getMessage());
}