Hi, I知 not sure why this not working, I知 trying to create signup form with email confirmation, they are two different table name in mysql one is called temps_users and other use us users.
When new member signed up it sending all of the new member profile to the temps_user tables, until member verify email by email conformation, if confirm then it will transfer the profile from temps_users to users tables and delete profile in temps_users.
So far I have done that and works great when transfer from temps_users to users, but after transfer the data profile from temps_users to users, meaning member are activity, I want to redirect to login.php page for them to login in before get into the member home page, the problem I have is that is not redirect to login.php page and delete profile from temps_users.

Please see the code area where it said $result2=mysql_query($sql); (see in bold area)
From that line is suppost to be redirect to login.php page and delete profile from temps_users.
Is not working what did I missed!



// Passkey that got from link 

// Retrieve data from table where row that match this passkey 
$sql1="SELECT * FROM temps_users WHERE confirm_code ='$passkey'";

// If successfully queried 

// Count how many row has this passkey

// if found this passkey in our database, retrieve data from table "temp_members_db"


// Insert data that retrieves from "temp_members_db" into table "registered_members" 
     $sql2=mysql_query("INSERT INTO users(username,password,email,type,first_name,last_name )VALUES('$username','$password','$email','$type','$first_name','$last_name' )");
	    $sql=mysql_query("SELECT uid FROM users WHERE username='$username'");
     $friend_query=mysql_query("INSERT INTO friends(friend_one,friend_two,role)VALUES('$uid','$uid','me')");

     return $uid ;

// if not found passkey, display message "Wrong Confirmation code" 
else {
echo "Wrong Confirmation code";

// if successfully moved data from table"temp_members_db" to table "registered_members" displays message "Your account has been activated" and don't forget to delete confirmation code from table "temp_members_db"


// Delete information of this user from table "temp_members_db" that has this passkey 
$sql3="DELETE FROM temps_users WHERE confirm_code = '$passkey'";