justlukeyou Posted December 31, 2012 Share Posted December 31, 2012 Hi, When I echo activationcode it displays: 50e1fa5ad38e7 When I echo accountnumber it displays: 50e1fa5ad38e7 In the database is: 50e1fa5ad38e7 This is the link that the created and sent via an email: activation.php?activationcode=50e1fa5ad38e7 This is the error message. Notice that the first 4 characters (50e1) are removed. This is the error message I receive: "An error occurred You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'fa5ad38e7' at line 4" Does anyone have any suggestions on how the activation code is shortened. <?php echo $row['activationcode']; ?> <?php if(($activationcode) == ($row['activationcode'])) { $errors['activationcode'] = "Congratulations. You have now successfully registered."; } ?> <?php $accounty = ('Y'); echo $activationcode; echo $accounty; $accountnumber = $activationcode; echo $accountnumber; if($error == "") { $sql = " UPDATE users SET accountconfirmed = '".$_GET['activationcode']."' WHERE activationcode=$accountnumber"; $result = mysql_query($sql) or die("An error occurred ".mysql_error()); } $result = mysql_query($query); // remove the or die(mysql_error()) if($result){ $success['register'] = 'Congratulations. Your account has been activated!<br><br>'; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/272563-activiation-code-inexplicably-shortens/ Share on other sites More sharing options...
Pikachu2000 Posted December 31, 2012 Share Posted December 31, 2012 Have you done anything to verify that's actually what's happening? Like perhaps echoing the query string along with the error? Quote Link to comment https://forums.phpfreaks.com/topic/272563-activiation-code-inexplicably-shortens/#findComment-1402476 Share on other sites More sharing options...
Christian F. Posted December 31, 2012 Share Posted December 31, 2012 Hmm... Who would have thought we'd see a scientific question coming from this end? Quote Link to comment https://forums.phpfreaks.com/topic/272563-activiation-code-inexplicably-shortens/#findComment-1402481 Share on other sites More sharing options...
Barand Posted January 1, 2013 Share Posted January 1, 2013 try quotes WHERE activationcode = '$accountnumber' Quote Link to comment https://forums.phpfreaks.com/topic/272563-activiation-code-inexplicably-shortens/#findComment-1402486 Share on other sites More sharing options...
justlukeyou Posted January 1, 2013 Author Share Posted January 1, 2013 (edited) try quotes WHERE activationcode = '$accountnumber' Cheers dude. Its another one of those codes that took 2 minutes to write but I just couldn't finish it off. I am now matching the activation code and inserting Y into a second column. I take it I can now adapt the login page to check if the Y is this column. If someone registers but forgets to click the activation link but tries to register again should I check if the email address already exists but if the Y doesn't exist to resend the activation link? Edited January 1, 2013 by justlukeyou Quote Link to comment https://forums.phpfreaks.com/topic/272563-activiation-code-inexplicably-shortens/#findComment-1402490 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.