on('postEdit', function( $editor, $json, $data ) Lock wait timeout exceeded; try restarting transact
on('postEdit', function( $editor, $json, $data ) Lock wait timeout exceeded; try restarting transact
commedia
Posts: 21Questions: 5Answers: 0
Hi!
I need to use postEdit function to update another table of my DB as follow:
$data->on('postEdit', function( $editor, $json, $data ) {
global $conn;
$ordinato = getOrdinato($data['fromNav_Disponibilita']['idArticolo']);
if ($ordinato) {
$idArticoloFisso = $ordinato['idArticoloFisso'];
$sqlUpdate = "UPDATE righe_disponibilita
SET idArticolo = '".$idArticoloFisso."'
WHERE idArticoloFisso = '".$idArticoloFisso."'";
if ( $resUpdate = $conn->query($sqlUpdate) ) {
// tutto ok
//echo $resUpdate;
} else {
echo $conn->error;
}
}
});
I get this error : Lock wait timeout exceeded; try restarting transaction
I don't know why. I do the same update for create as follow
if ( isset($_POST['action']) && $_POST['action'] === 'create' ) {
$ordinato = getOrdinato($_POST['data'][0]['fromNav_Disponibilita']['idArticolo']);
if ($ordinato) {
$idArticoloFisso = $ordinato['idArticoloFisso'];
$sqlUpdate = "UPDATE righe_disponibilita
SET idArticolo = '".$idArticoloFisso."'
WHERE idArticoloFisso = '".$idArticoloFisso."'";
if ( $resUpdate = $conn->query($sqlUpdate) ) {
// tutto ok
//echo $resUpdate;
} else {
echo $conn->error;
}
}
}
and all goes well.
Thank you
Pat
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Could you try adding
->transaction( false )
immediately prior to where you call the->process()
method please?Thanks,
Allan
Hi Allan!
YES all is ok! Thank you very much!
Pat