06-12-2012, 09:42 PM
|
#1 (permalink)
|
|
The Visitor
Join Date: Jun 2012
Posts: 2
Thanks: 1
|
mysql_num_rows(): supplied argument is not a valid MySQL result resource
Hey guys,
I was working through the tutorial on creating registration page. On Activation PHP went through the coding error:
Mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/content/68/9152261/html/activation.php on line 16.
Tried different variation nothing works... so frustrated. I thought professional opinion would help to find a problem. Please help!!! Here is the code:
<?php
if($_GET['id']!=""){
include_once "connect_to_mysql.php";
$id = $_GET['id'];
$hashpass = $_GET['sequence'];
$id = mysql_real_escape_string($id);
$id = eregi_replace("`", "", $id);
$hashpass = mysql_real_escape_string($hashpass);
$hashpass = eregi_replace("`", "",$hashpass);
$sql = mysql_query("UPDATE members SET email_activated='1' WHERE id='$id' AND password='$hashpass'");
$sql_doublecheck = mysql_query("SELECT * FROM members WHERE id='$id' AND password='$hashpass' AND email_activated='1'");
$doublecheck = mysql_num_rows($sql_doublecheck);
if($doublecheck == 0){
$msgToNewMember = "</br></br><h3><strong><font color=red>Your account could not be activated</font></strong></h3><br/>
Please contact us regarding your activation via email";
include 'msgToNewMember.php';
exit();
} else if($doublecheck>0) {
$msgToNewMember = "<br/><br/><strong><font color=\"#0066CC\">You successfully activated your account!<br/>
Now you can login to your account.</font></strong><h3>";
include 'msgToNewMember.php';
exit();
}
}
print "Essential part from activation link is missing! Please copy full activation link that was supplied in our email to you and paste it in a new browser address bar. Thank you!
</br>
";
?>
Thank you very much!
|
|
|
|