I have a signup script with email confirmation and its working almost fine. The users info is firstly sent from form to a "temp" table and when he follows the email confirmation link the info goes from "temp" table to "india" table, its final destination.
The confirmation link is a file called "confirmation.php".
Although the code is sending data from one table to the other, it is not printing the message "Obrigado, o seu registo foi validado.", portuguese for "Thanks, your registration was now validated". What am i doing wrong?
Thanks!
Confirmation.php
<?php
include_once ('config.php');
$confirm_code = $_GET["confirm_code"];
$sql1 = mysqli_query($conn, "SELECT * FROM temp WHERE confirm_code = '$confirm_code'");
$result1= mysqli_fetch_array($sql1, MYSQLI_ASSOC);
if(mysqli_num_rows($sql1) == 1) {
$query = mysqli_query($conn, "INSERT INTO india (confirm_code, name, password, email) SELECT confirm_code, name, password, email FROM temp WHERE confirm_code = '$confirm_code'");
if($query) {
$del = mysqli_query($conn, "DELETE FROM temp WHERE confirm_code = '$confirm_code'");
if($del) {
$msg = "Obrigado, o seu registo foi validado.";
}
}
} else {
$msg2 = "Erro no registo";
}
$conn->close();
?>