Exception or error:
I have a simple question, I wanted to know how to make a database query run at the end of the previous one.
In my case I am doing an insert and then an update of that insert.
Does not update because the insert has not finished.
This is all in php
$id_mensaje_converted = "123";
$body_str = "Hello";
$consulta = "INSERT INTO mensajes (id_mensaje, body) VALUES ('$id_mensaje_converted', '$body_str')";
$resultado = mysqli_query( $conexion, $consulta );
//Then by post I receive a status
if (isset($_POST['status'])){
$status_str = $_POST['status'];
$consulta = "UPDATE mensajes SET status = '$status_str' WHERE id_mensaje ='$id_mensaje_converted'";
$resultado = mysqli_query( $conexion, $consulta );
}
How to solve: