Jump to content

[SOLVED] Need help with an UPDATE to my database


austin6118

Recommended Posts

I have a user sign up and then an email confirmation link gets send to them. When they register I set their status as 0. When they click the click I want the database to be updated to status as 1. Thanks in advance


<?php
include('connectDB.php');

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



// Retrieve data from table where row that match this passkey
$sql1="SELECT 'confirm_code' FROM temp 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"
if($count==1){

$rows=mysql_fetch_array($result1);
$username=$rows['username'];
$email=$rows['email'];
$password=$rows['password'];




// Insert data that retrieves from "temp" into table "reminder"
$sql2="UPDATE 'temp' SET status='1' WHERE username='$username' and password='$password'";
$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" to table "reminder" 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";


}

}
?>

 

[attachment deleted by admin]

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.