droidus Posted June 25, 2011 Share Posted June 25, 2011 i have the following php code to delete an account. The only problem is, I enter the right password, and it does nothing. I enter the wrong password, and i get "bad". why isn't my success code/message executing? thanks in advance! <?php // BEGIN TERMINATION OF ACCOUNT if(isset($_POST['terminate'])) { if (empty($_POST['terminatePassword'])) { $errors_terminate = "<div class='errors'>Please type in your account password to continue.</div>"; } $password = md5($_POST['terminatePassword']); mysql_select_db($database_uploader, $uploader); $query = "SELECT * FROM members WHERE uname = '$_SESSION[user]' AND pword='$password'"; $result = mysql_query($query) or die(mysql_error()); if (mysql_num_rows($result) > 0) { $row = mysql_fetch_array($result) or die(mysql_error()); if ((($row['pword']) == $password) && ($row['uname'] == $_SESSION['user'])) { "Your account has been successfully deleted. Goodbye!"; mysql_close($result); } else { echo "We are sorry, but the password you have entered is not valid."; mysql_close($result); } } else echo "bad"; } ?> MOD EDIT: code tags added. Link to comment https://forums.phpfreaks.com/topic/240344-terminate-account-error/ Share on other sites More sharing options...
Pikachu2000 Posted June 25, 2011 Share Posted June 25, 2011 When posting code, enclose it within the forum's . . . BBCode tags. Where is the code for the form you're using? have you tried a print_r() of the $_POST array to make sure it contains what you'd expect it to contain? Link to comment https://forums.phpfreaks.com/topic/240344-terminate-account-error/#findComment-1234571 Share on other sites More sharing options...
droidus Posted June 25, 2011 Author Share Posted June 25, 2011 gr, i forgot to echo, of course! sorry, how do you delete a thread? Link to comment https://forums.phpfreaks.com/topic/240344-terminate-account-error/#findComment-1234572 Share on other sites More sharing options...
Pikachu2000 Posted June 25, 2011 Share Posted June 25, 2011 You don't delete threads. You're aware there's nothing in that code, such as an UPDATE query, to actually change the record in the database right? Link to comment https://forums.phpfreaks.com/topic/240344-terminate-account-error/#findComment-1234576 Share on other sites More sharing options...
droidus Posted June 25, 2011 Author Share Posted June 25, 2011 yes, i am. i am still trying to get the hang of things. i am working on it now. i work in baby steps because if i build it all at once, its a big mess lol Link to comment https://forums.phpfreaks.com/topic/240344-terminate-account-error/#findComment-1234577 Share on other sites More sharing options...
Pikachu2000 Posted June 25, 2011 Share Posted June 25, 2011 I kind of figured you knew it, but I had to ask just in case . . . Link to comment https://forums.phpfreaks.com/topic/240344-terminate-account-error/#findComment-1234578 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.