EviLSpaWn Posted March 9, 2009 Share Posted March 9, 2009 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 Quote Link to comment https://forums.phpfreaks.com/topic/148653-moving-data/ Share on other sites More sharing options...
jackpf Posted March 9, 2009 Share Posted March 9, 2009 Well it appears you've commented out the entire part where it gets the data from the database. You also haven't assigned them to any variable... Quote Link to comment https://forums.phpfreaks.com/topic/148653-moving-data/#findComment-780606 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.