austin6118 Posted May 3, 2009 Share Posted May 3, 2009 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] Quote Link to comment https://forums.phpfreaks.com/topic/156708-solved-need-help-with-an-update-to-my-database/ Share on other sites More sharing options...
Ken2k7 Posted May 3, 2009 Share Posted May 3, 2009 $sql2="UPDATE `temp` SET status='1' WHERE username='$username' and password='$password'"; You had temp in quotes. I changed them to backticks. Quote Link to comment https://forums.phpfreaks.com/topic/156708-solved-need-help-with-an-update-to-my-database/#findComment-825197 Share on other sites More sharing options...
austin6118 Posted May 3, 2009 Author Share Posted May 3, 2009 OHHH MYY GODDD...thank you sooooo much...I just spent the last hour freaking out because it wouldn't work. THANKS AGAIN. Quote Link to comment https://forums.phpfreaks.com/topic/156708-solved-need-help-with-an-update-to-my-database/#findComment-825204 Share on other sites More sharing options...
Maq Posted May 3, 2009 Share Posted May 3, 2009 OHHH MYY GODDD...thank you sooooo much...I just spent the last hour freaking out because it wouldn't work. THANKS AGAIN. Please mark as SOLVED if that's the case. Quote Link to comment https://forums.phpfreaks.com/topic/156708-solved-need-help-with-an-update-to-my-database/#findComment-825231 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.