这个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();
答案 0 :(得分:0)
试试这个:
$sql=" UPDATE Listing SET
rentStartDate = ?,
rentEndDate = ?
WHERE address = ?";
$stmt = $db->prepare($sql);
$stmt->bind_param('sss', $rentStartDate,$rentEndDate,$address);
$stmt->execute();