Answer the question
In order to leave comments, you need to log in
How to use transactions in mysqli prepared statements?
I did this but I don't think it works
$stmt->autocommit(FALSE);
$stmt->prepare('insert into `gmy_table` (`name`,`dollar`) values (?,?)');
$stmt->bind_param('si',$name, $dollar); // первым параметром указываем тип привязываемых //данных: i – integer, d – double, s - string
$stmt->execute();
echo $stmt->affected_rows;
echo 'iiiiiiiiiiiiiiii'.$stmt->insert_id;
$stmt->free_result();
$stmt->close(); // закрываем подготовленный запрос.
$stmt= $mysqli->stmt_init();
$stmt->prepare('insert into `my_table` (`name`,`dollar`) values (?,?)');
if ($mysqli->errno) throw new Exception($mysqli->error, $mysqli->errno);
$stmt->bind_param('si',$name, $dollar); // первым параметром указываем тип привязываемых //данных: i – integer, d – double, s - string
$stmt->execute();
echo $stmt->affected_rows;
echo 'aaaaaaaaaaaaaaa'.$stmt->insert_id;
$stmt->free_result();
$stmt->close(); // закрываем подготовленный запрос.
$stmt->commit();
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question