Hello again.
I've been recoding a section of script that's refusing to run for no apparent reason and have encountered a whole new set of issues.
The script I'm running basically retrieves a username and password from the link a user clicks on in their activation email, and updates their account to activated.
It then double checks that the account is activated, and lets them know of any problems.
The error I'm getting is:
Warning: mysql_numrows(): supplied argument is not a valid MySQL result resource in /home/hollowd/public_html/login/activate.php on line 15
And the script I'm running looks like this:
<?
//Establish the database connection
$conn = mysql_connect("localhost", "hollowd_php", "******");
$select = mysql_select_db("profiles", $conn);
//Request the info from the URL
$userid = $_REQUEST['id'];
$code = $_REQUEST['code'];
//Activate the users account
$update = mysql_query("UPDATE profiles SET activated='1' WHERE userid='$userid' AND password='$code'");
//Check account is activated
$sql_check = "SELECT * FROM profiles WHERE userid='$userid' AND password='$code' AND activated='1'";
$check = mysql_query($sql_check, $conn);
$result = mysql_num_rows($check);
//Let the user know the result
if ($result == 0){
PRINT "Your account could not be activated, please contact [email]webmistress@hollowdreams.net[/email]";
} elseif ($check > 0) {
PRINT "Your account has been activated. You may now log in";
} else {
PRINT "Something happened, I don't know what but it just ain't right";
}
?>
I seem to be returning this "supplied argument is not a valid MySQL result resource" error a lot . . . Am I reading it right in assuming it occurs when the data fed to mysql_num_rows is wrong in some way?
If so, how can I fix it in this script?
Thanks in advance,
Roses