0
此SQL不起作用,我試圖用rowCount()和print_r($ array)修復它幾個小時,但沒有運氣。更新準備好的語句不起作用
感謝所有幫助!
$sql=" UPDATE Listing SET
rentStartDate = :rentStartDate,
rentEndDate = :rentEndDate,
backyard = :backyard,
pricePerMonth = :pricePerMonth,
noOfBathrooms = :noOfBathrooms,
roomCapacity = :roomCapacity,
currentNoOfuser = :currentNoOfuser,
accessToPublicTrans = :accessToPublicTrans,
parkingSpace = :parkingSpace,
minimumLengthOfStay = :minimumLengthOfStay
WHERE address = :address ";
$stmt = $db->prepare($sql);
$stmt->bindValue(':address', $address);
$stmt->bindValue(':rentStartDate', $rentStartDate);
$stmt->bindValue(':rentEndDate', $rentEndDate);
$stmt->bindValue(':backyard', $backyard);
$stmt->bindValue(':pricePerMonth', $pricePerMonth);
$stmt->bindValue(':noOfBathrooms', $noOfBathrooms);
$stmt->bindValue(':roomCapacity', $roomCapacity);
$stmt->bindValue(':currentNoOfuser', $currentNoOfuser);
$stmt->bindValue(':accessToPublicTrans', $accessToPublicTrans);
$stmt->bindValue(':parkingSpace', $parkingSpace);
$stmt->bindValue(':minimumLengthOfStay', $minimumLengthOfStay);
$stmt->execute();
你得到什麼錯誤? –
嘗試打開錯誤報告,或將所有內容放入try {} catch(PDOException $ e){echo $ e-> getMessage(); }塊。發佈錯誤(如果有的話) –
將你的代碼放入['try-catch'塊](http://pastebin.com/aLcFLxby)。 –