I have a function that does a UPDATE
I would like to know if with the same function I can make more than UPDATE
for example in 2 tables in db. Is there any possibility ? I would also like to know the syntax if it exists.
Code:
public function editar(Prog $prog){
$this->conn->beginTransaction();
try {
$stmt = $this->conn->prepare(
'UPDATE ESP353Prog SET NrProg = :NrProg, DtProg = :DtProg, NrPlaca = :NrPlaca, NrPlacaCarreta = :NrPlacaCarreta,
NrPlacaReboque2 = :NrPlacaReboque2, DsMotorista = :DsMotorista, DsOrigem = :DsOrigem, DsDestino = :DsDestino, QtPesoTtl = :QtPesoTtl
WHERE ID = :ID');
$stmt->bindValue(':ID', $prog->getid(), PDO::PARAM_INT);
$stmt->bindValue(':NrProg', $prog->getprog(), PDO::PARAM_INT);
$stmt->bindValue(':DtProg', $prog->getdataopr(), PDO::PARAM_INT);
$stmt->bindValue(':NrPlaca', $prog->getplaca(), PDO::PARAM_INT);
$stmt->bindValue(':NrPlacaCarreta', $prog->getcarreta(), PDO::PARAM_INT);
$stmt->bindValue(':NrPlacaReboque2', $prog->getreboque(), PDO::PARAM_INT);
$stmt->bindValue(':DsMotorista', $prog->getmot(), PDO::PARAM_STR);
$stmt->bindValue(':DsOrigem', $prog->getorig(), PDO::PARAM_STR);
$stmt->bindValue(':DsDestino', $prog->getdest(), PDO::PARAM_STR);
$stmt->bindValue(':QtPesoTtl', $prog->getpesottl(), PDO::PARAM_INT);
$stmt->execute();
$this->conn->commit();
}
catch(Exception $e) {
$this->conn->rollback();
}
}