When I retrieve value from table to another it inserted blank

lamaindia

New Member
I have two tables[*]users[*]registered_membersI want to confirm values from user table and then insert it in registered_members table but the problem is .. values selected good from users table but inserted in registered_members with blank values Why??\[code\]<?include('conf.php');// Passkey that got from link$passkey=$_GET['passkey'];$tbl_name1="users";// Retrieve data from table where row that match this passkey$sql1="SELECT * FROM $tbl_name1 WHERE confirm_code ='$passkey'";$result1=mysql_query($sql1) or die ("error1") ;// If successfully queriedif($result1){// Count how many row has this passkey$count=mysql_num_rows($result1);// if found this passkey in our database, retrieve data from table "users"if($count==1){$rows=mysql_fetch_array($result1);$username=$_POST['uname'];$fname=$_POST['fname'];$password=$_POST['password'];$email=$_POST['email'];$age=$_POST['age'];$gender=$_POST['gender'];$tbl_name2="registered_members";// Insert data that retrieves from "users" into table "registered_members"$sql2=("INSERT INTO $tbl_name2 (uname,fname,password,email,age,gender)VALUES('$username','$fname','$password','$email','$age','$gender')");$result2=mysql_query($sql2) or die ("error insert");}// if not found passkey, display message "Wrong Confirmation code"else {echo "Wrong Confirmation code";}// if successfully moved data from table"users" to table "registered_members" displays message "Your account has been activated" and don't forget to delete confirmation code from table "users"if($result2){echo "Your account has been activated";// Delete information of this user from table "temp_members_db" that has this passkey$sql3="DELETE FROM $tbl_name1 WHERE confirm_code = '$passkey'";$result3=mysql_query($sql3);}}?>\[/code\]
 
Back
Top