jwk811 Posted October 15, 2006 Share Posted October 15, 2006 I am creating a membership and got it so that someone can register and the info goes to a database.. after that they recieve an email and are given a link to click to activate their account. Heres the acivate.php file.[code]<? /* Account activation script */ // Get database connection include 'db.php'; // Create variables from URL. $userid = $_REQUEST['id']; $code = $_REQUEST['code']; $sql = mysql_query("UPDATE users SET activated='1' WHERE userid='$userid' AND password='$code'"); $sql_doublecheck = mysql_query("SELECT * FROM users WHERE userid='$userid' AND password='$code' AND activated='1'"); $doublecheck = mysql_num_rows($sql_doublecheck); if($doublecheck == 0){ echo "<strong><font color=red>Your account could not be activated!</font></strong>"; } elseif ($doublecheck > 0) { echo "<strong>Your account has been activated!</strong> You may login below!<br />"; include 'login.php'; } ?>[/code]For some reason everytime I do it, it will say "Your account could not be activated!". And I can see that in the if else statment its double checking to make sure that the activated cell in the table on my database is set to 1, but why isn't is setting it to 1? That's why I'm getting the error? Would you happen to know why? I'm connecting to the database and everything okay, is there something wrong with this script? Any help would be great! Quote Link to comment Share on other sites More sharing options...
zq29 Posted October 15, 2006 Share Posted October 15, 2006 Do you get any errors returned when altering this line:[code]$sql = mysql_query("UPDATE users SET activated='1' WHERE userid='$userid' AND password='$code'") or die(mysql_error()); [/code] Quote Link to comment Share on other sites More sharing options...
jwk811 Posted October 15, 2006 Author Share Posted October 15, 2006 i dont understand.... Quote Link to comment Share on other sites More sharing options...
jwk811 Posted October 16, 2006 Author Share Posted October 16, 2006 i replaced that line with that and it still wont go through Quote Link to comment 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.