0
Good, at the moment I’m doing a project with html, php and mysql and I’m having a little problem now.
Getting to the point:
Assuming I have two tables: unconfirmed and confirmed, and what I want is, on the php page manage to pass the unconfirmed table data to the confirmed, but when passing the data to the confirmed table I wanted that record to disappear from the unconfirmed table. (in this case the unconfirmed table is called "guest").
Excuse the way I’ve arranged to try to explain, in case you don’t notice something, say I try to explain myself better.
<?php
include ('ligar.php');
$sql = "select * from hospede";
$cod_hospede=$_GET['cod_hospede'];
$sql = "INSERT INTO confirmados SELECT * FROM hospede WHERE cod_hospede = '$cod_hospede'";
$result = mysqli_query($con, $sql);
if ($result)
echo "<br><br>Dados registados com sucesso!";
else
echo "Erro ao tentar registar dados na base de dados!";
?>
<br>
<a href="confirmados.php">voltar</a>
With your code it already inserts? If yes, just delete after. Do this within a transaction to not have future problems.
– Woss
Yes, it inserts and it actually goes to the other table, but I want you to delete it from the unconfirmed table. I already tried to delete but gave me error (in this case, it did not go to the other table and was simply removed).
– Ivo Miguel