I have problems with my syntax for updating two tables in one go. My code currently looks like this:
if ($stmt = $mysqli->prepare('
BEGIN TRANSACTION
UPDATE items_woods
SET items_woods.oak = ´1´
FROM items_woods T1, skills_woodcutting T2
WHERE T1.id = T2.id
and T1.id = ´?´
UPDATE skills_woodcutting
SET skills_woodcutting.exp = ´1´
FROM items_woods T1, skills_woodcutting T2
WHERE T1.id = T2.id
and T1.id = ´?´
COMMIT
')) {
/* Bind parametres */
$stmt->bind_param('i', $id);
/* Insert the parameter values */
$id = 1;
/* Execute the query */
$stmt->execute();
/* Close statement */
$stmt->close();
} else {
/* Something went wrong */
echo 'Something went terrible wrong' . $mysqli->error;
}
I am running a MySQL server and I can't see where the problem is, if anyone can hint me to a correct syntax, it will be appreciated. Thanks.