txrandom Posted August 8, 2006 Share Posted August 8, 2006 In my script, the user enters his activation code. If the activation code matches the one found in the database, the users data associated with that activation code is selected from the unactivated user table and added to the activated user table. My script also deletes activation codes that have already been used. My only problem is that my script will not delete the row in the unactivated user table.[code]<?phpinclude "config.php";$activation = $_GET['id'];$query="SELECT * FROM uauser WHERE activation='$activation'";$result=mysql_query($query);$num=mysql_num_rows($result);if ($num > 0 ) {$row = mysql_fetch_assoc ($result);$user = $row['user'];$password = $row['password'];$realname = $row['realname'];$email = $row['email'];$joineddate = $row['joindeddate'];mysql_query("DELETE FROM 'uauser' WHERE activation='$activation' LIMIT 1");$query = "INSERT INTO user (user, password, realname, email, joineddate) VALUES('".$user."','".$password."','".$realname."','".$email."','".$joineddate."')"; $result = mysql_query($query);echo "Activation successful!";} else {echo "Activation unsuccessful. Your activation code wasn't found.";}?>[/code]Help is much appreciated. The deletion codes perfectly in a script that just deletes stuff. I think since I queried the database before I tried deleting stuff, it is getting messed up. Quote Link to comment Share on other sites More sharing options...
txrandom Posted August 8, 2006 Author Share Posted August 8, 2006 I just tried it by itself and it didn't work either. An exact script but with different table and field names works fine on another part of my site.[code]<?phpinclude "config.php";$activation = $_GET['id'];mysql_query("DELETE FROM 'uauser' WHERE activation='$activation'") or die();echo "must of worked";?>[/code]No one has any idea what I'm doing wrong? Quote Link to comment Share on other sites More sharing options...
txrandom Posted August 8, 2006 Author Share Posted August 8, 2006 Could this problem have something to do with my MySQL accounts permissions? I'm going to test this script on my other server and see if it works. If it does, I think it's a permissions issue. How do I change an accounts permissions? I lost the walkthrough I use to have. Quote Link to comment Share on other sites More sharing options...
txrandom Posted August 8, 2006 Author Share Posted August 8, 2006 Well, I found a different way to do a user activation. But I'm still curious as to why I can't delete it! Quote Link to comment Share on other sites More sharing options...
hackerkts Posted August 8, 2006 Share Posted August 8, 2006 Hmm.. Why not just change it to 0 = unactivated and 1 = activated ? Quote Link to comment Share on other sites More sharing options...
txrandom Posted August 8, 2006 Author Share Posted August 8, 2006 Yah, I ended up doing that. I'm just hoping this problem won't bug me when I absolutely have to be able to delete a row. Quote Link to comment Share on other sites More sharing options...
hackerkts Posted August 8, 2006 Share Posted August 8, 2006 Example of deleting..[code]mysql_query("DELETE FROM `left` WHERE `key` = '$key' LIMIT 1") or die (mysql_error());[/code] 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.