Jump to content

Recommended Posts

Hi im new to this php and mysql stuff i found this script but it wont work i have a login system that when users register it stores there info in a temp_Database and sends them an email to confirm the account then it should move the info from the temp_database to a member_database and delete the temp_database selection the only thing i cant get it to do it move the info its just creates a blank field where only the id is visible.. this is my code......

 

mysql_connect("$host", "$username", "$password")or die("Cannot Connect"); 
mysql_select_db("$db_name")or die("cannot select DB");

// Passkey that got from link 
$passkey=$_GET['passkey'];

$tbl_name1="temp_members";

// Retrieve data from table where row that match this passkey 
$sql1="SELECT * FROM $tbl_name1 WHERE confcode='$passkey'";
$result1=mysql_query($sql1);

// If successfully queried 
if($result1){

// Count how many row has this passkey
$count=mysql_num_rows($result1);

// if found this passkey in our database, retrieve data from table "temp_members"
if($count==1){

$rows=mysql_fetch_array($result1);

/* $rows['fname'];
$rows['lastname'];
$rows['address1'];
$rows['address2'];
$rows['mycity'];
$rows['mypostzip'];
$rows['mycountry'];
$rows['myemailad'];
$rows['mypassword'];
*/
$tbl_name2="members";

// Insert data that retrieves from "temp_members" into table "members" 
$sql2="INSERT INTO $tbl_name2(fname, lastname, address1, address2, mycity, mypostzip, mycountry, myemailad, mypassword)VALUES('$fname', '$lastname', '$address1', '$address2', '$mycity', '$mypostzip', '$mycountry', '$myemailad', '$mypassword')";
$result2=mysql_query($sql2);
}
// 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 "members" displays message "Your account has been activated" and don't forget to delete confirmation code from table "temp_members_db"
if($result2){

echo "Your Account Has Been Activated";

// Delete information of this user from table "temp_members" that has this passkey 
$sql3="DELETE FROM $tbl_name1 WHERE confcode = '$passkey'";
$result3=mysql_query($sql3);

}

}
?>

please any help would be grate as its giving me plenty of head aches  :D

Link to comment
https://forums.phpfreaks.com/topic/148653-moving-data/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.