我有这个PDO更新语句在更新文本时工作正常,直到我添加了第二个WHERE子句。添加post.SID =:SID之后,即使我没有错误,文本也不再在mysql中更新。您是否可能在PDO语句中不能有多个WHERE子句?这是文字:
$current = $latestposition[0]['position'];
$this = $the_SID;
if(isset($_POST ['submit'])){
$formtext = $_POST['$contedit'];
$upda = 'UPDATE writing SET text=:text where snippets.SID=:SID and approved=:approved and position=:position';
$stmt = $dbh->prepare($upda);
$stmt->bindParam(':text', $formtext, PDO::PARAM_STR);
$stmt->bindParam(':SID', $this, PDO::PARAM_INT);
$stmt->bindParam(':position', $current, PDO::PARAM_INT);
$stmt->bindParam(':approved', $z = Y, PDO::PARAM_STR);
$stmt->execute();