-1
Good afternoon,
How can I do a simultaneous INSERT? I want you to insert the data from one table into the other table as well!
Database: MYSQL
Insertion script:
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
	<title>Cadastro de Processos</title>
	<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">
	<link rel="stylesheet" type="text/css" href="css/custom.css">
	<style type="text/css">
	<!--
.loader {
	margin: 0 auto;
  border: 12px solid #000000;
  border-radius: 50%;
  border-top: 7px solid black;
  border-right: 7px solid grey;
  border-bottom: 7px solid black;
  border-left: 7px solid grey;
  width: 50px;
  height: 50px;
  -webkit-animation: spin 2s linear infinite;
  animation: spin 1s linear infinite;
}
@-webkit-keyframes spin {
  0% { -webkit-transform: rotate(0deg); }
  100% { -webkit-transform: rotate(360deg); }
}
@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}
.center1 {
	text-align: center;
}
<!---->
</style>
</head>
<body>
	<div class='container box-mensagem-crud'>
		<?php 
		require 'conexao.php';
		$conexao = conexao::getInstance();
		$acao  = (isset($_POST['acao'])) ? $_POST['acao'] : '';
	
		$numero = $_POST['numero'];
		$assunto = $_POST['assunto'];
		$requerente = $_POST['requerente'];
		$status = $_POST['status'];
		$informe = $_POST['informe'];
		$data = $_POST['data'];
		
		if ($acao == 'incluir'):
		
 
		$processos = "INSERT INTO processos(numero, assunto, requerente, status)
			VALUES(:numero, :assunto, :requerente, :status)";
			$stm = $conexao->prepare($processos);
			$stm->bindValue(':numero', $numero);			
			$stm->bindValue(':assunto', $assunto);
			$stm->bindValue(':requerente', $requerente);
			$stm->bindValue(':status', $status);
			$retorno = $stm->execute();
			
			if ($retorno){
			
			$informes = "INSERT INTO informes(informe, data)
			VALUES (:informe, :data)";
			
			$tsm = $conexao->prepare($informes);
			$tsm->bindValue(':informe', $informe);
			$tsm->bindValue(':data', $data);
			$lol = $tsm->execute();
			}
			
			if ($lol):
			
				echo "<div class='center1' role='alert'>Processo inserido com sucesso, aguarde você está sendo redirecionado...</div> ";
				echo "<div class='loader'</div>";
		    else:
		    	echo "<div class='center1' role='alert'>Erro ao inserir processo, aguarde!</div>";
				echo "<div class='loader'</div>";
			endif;
			echo "<meta http-equiv=refresh content='4;URL=listarprocessos.php'>";
			
		endif;
		
				?>
		
	</div>
</body>
</html>
Table Processes:
Table Informes:


And how would I apply this in the INSERT of the reports? $informes = "INSERT INTO informes(enter, date, '$ultimo_valor_inserted')? VALUES (:enter, :date, :'$ultimo_valor_inserted)";
– Bernardo Rodel
//Sentença de inserção do elemento 
$ssql = "INSERT INTO cliente (nome_cliente, BI, morada, email) VALUES ('xxx Nome empresa', 'B3331113', 'Rua Corona 2', '[email protected]')"; 

//inserto-o na base de dados 
if (mysql_query($ssql,$connectid)){ 

 //recebo o último id<br>
 $ultimo_id = mysql_insert_id($connectid); 
 echo $ultimo_id; 
}else{ 
 echo "A inserção não se realizou"; 
}– Danielle Arruda torres
did not understand how this is applied in the insertion of the other table, pardon!
– Bernardo Rodel
you first insert, then create a variable that takes mysql_insert_id(); then in the other Insert you pass this variable. Search how to use mysql_insert_id();
– Danielle Arruda torres
you can enter and after a select max searching for the last value by inserting too
– Danielle Arruda torres