Jump to content

Can't get it to delete


frank_solo

Recommended Posts

After the script moves the info into the new database it does not delete the row. 

<?php
include('config.php');
if($_SERVER["REQUEST_METHOD"] == "POST")
{
// Username from link 
$username=htmlentities($_GET['username']);
$confirm_code=htmlentities($_GET['confirm_code']);
$tbl_name1="forgetpass";

// Retrieve data from table where row that match this passkey 
$sql1="SELECT * FROM $tbl_name1 WHERE confirm_code ='$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_db"
if($count==1){
;
$rows=mysql_fetch_array($result1);
$username=$rows['username'];
}else{

$password=mysql_real_escape_string($_POST['password1']);
if(!$_POST["password1"] || !$_POST["password2"]){
		$error="Please fill the required fields";
	}else if(empty($username)){
		$error="No Confirmation Link Sent";
	}else if($_POST["password1"] != $_POST["password2"]){
		$error="PASSWORDS do not match!";	
	//validate password length
	}else if(strlen($_POST["password1"]) < 6){
		$error="PASSWORD is too short! Must be 6 characters long";
	}else{
		$password=$_POST['password1'];
		// it is acceptable, so hash it
		$encrypt_password="Some Hashing";
		
		// Insert data into database 
		$sql2="UPDATE user SET password = '$encrypt_password' WHERE username = '$username'";
		$result2=mysql_query($sql2);
		// if suceesfully inserted data into database, send confirmation link to email 
		if($result2){
			
			$status="Your Password Has Been Reset";
                                                // Delete information of this user from table "temp_members_db" that has this passkey 
$sql3="DELETE FROM $tbl_name1 WHERE confirm_code = '$confirm_code'";
$result3=mysql_query($sql3);

 

} } } } } ?>

 

 

Link to comment
Share on other sites

HA! Its late here in NY. Need to go to sleep, but I changed and it still does not delete. This is what I have now:
 

<?php
include('config.php');
if($_SERVER["REQUEST_METHOD"] == "POST")
{
// Username from link 
$username=htmlentities($_GET['username']);
$confirm_code=htmlentities($_GET['confirm_code']);
$tbl_name1="forgetpass";

// Retrieve data from table where row that match this passkey 
$sql1="SELECT * FROM $tbl_name1 WHERE confirm_code ='".$confirm_code."'";
$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_db"
if($count==1){
;
$rows=mysql_fetch_array($result1);
$username=$rows['username'];
}else{

$password=mysql_real_escape_string($_POST['password1']);
if(!$_POST["password1"] || !$_POST["password2"]){
		$error="Please fill the required fields";
	}else if(empty($username)){
		$error="No Confirmation Link Sent";
	}else if($_POST["password1"] != $_POST["password2"]){
		$error="PASSWORDS do not match!";	
	//validate password length
	}else if(strlen($_POST["password1"]) < 6){
		$error="PASSWORD is too short! Must be 6 characters long";
	}else{
		$password=$_POST['password1'];
		// it is acceptable, so hash it
		$encrypt_password="Some Hashing");
		
		// Insert data into database 
		$sql2="UPDATE user SET password = '$encrypt_password' WHERE username = '$username'";
		$result2=mysql_query($sql2);
		// if suceesfully inserted data into database, send confirmation link to email 
		if($result2){
			
			$status="Your Password Has Been Reset";
			// Delete information of this user from table "temp_members_db" that has this passkey 
			$sql3="DELETE FROM $tbl_name1 WHERE confirm_code = '".$confirm_code."'";
			$result3=mysql_query($sql3);
			
		}
			}
				}
					}
						}
?>
Link to comment
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.