iisthesloth Posted July 31, 2007 Share Posted July 31, 2007 Hey guys, this has been driving me crazy. I have this activation page users go to from a link which is sent to their email to activate their account. However I'm getting this error. I'm using PHP 5. Notice: Query/n MySQL Error: 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 ''5b25e4e069b4a7efe22114c05f058d79') LIMIT 1' at line 1 in /home/.navigator/iisthesloth/rolldc.com/traderp/activate.php on line 23 Your account could not be activated, please check the link. That activation number does match the one in the database too. Can anyone find anything wrong in the activation code? <? if (isset($_GET['x'])) { $x = (int) $_GET['x']; } else { $x = 0; } if (isset($_GET['y'])) { $y = $_GET['y']; } else { $y = 0; } if ( ($x > 0) && (strlen($y) == 32)) { require_once ('../../mysql_rolldc_connect.php'); $query = "UPDATE users SET active=NULL WHERE (user_id=$x AND active'" . escape_data($y) . "') LIMIT 1"; $result = mysql_query ($query) or trigger_error("Query/n<br />MySQL Error: " . mysql_error()); if (mysql_affected_rows() == 1) { echo "<h3>Your acount is now active. You may login."; } else { echo 'Your account could not be activated, please check the link.'; } mysql_close(); } else { $url = 'http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']); if ((substr($url, -1) == '/') OR (substr ($url, -1) == '\\') ) { $url = substr ($url, 0, -1); } $url .= '/index.php'; ob_end_clean(); header("Location: $url"); exit(); } ?> Thanks alot! Quote Link to comment https://forums.phpfreaks.com/topic/62615-help-with-activation-page/ Share on other sites More sharing options...
calabiyau Posted July 31, 2007 Share Posted July 31, 2007 $query = "UPDATE users SET active=NULL WHERE (user_id=$x AND active'" . escape_data($y) . "') LIMIT 1"; I think you're missing an equal sign after active...also not sure you need the parenthesis before user_id and after escape_data Quote Link to comment https://forums.phpfreaks.com/topic/62615-help-with-activation-page/#findComment-311685 Share on other sites More sharing options...
iisthesloth Posted July 31, 2007 Author Share Posted July 31, 2007 The equal sign was it! Thanks a lot, certainly an error in one of my php books... Quote Link to comment https://forums.phpfreaks.com/topic/62615-help-with-activation-page/#findComment-311688 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.