Update sql with pdo

This one worked until I added some more rows to be updated in it. Can anyone help me see the problem ?

$sql=$oDB->Prepare("UPDATE planetmarket SET price=:price, buyprice=:bprice, amount=:amount WHERE id=:pmid");
$sql->execute(array(':price' => $newMarketPrice, ':buyprice' => $bprice, ':amount' => $newMarketAmount, ':pmid' => $pmid));

You should have PDO always set in exception mode, to let it tell you what’s going wrong. Please add


to your PDO creation code, as shown here

After that PDO will tell you what’s the problem. Note that of course you should be able to see PHP errors in general.

On the second glance, there is a typo in your placeholders, buyprice <> bprice

1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.