if (!empty($_POST)){
$email_to=$_POST['email_to']; $email_to=mysql_real_escape_string($_POST['email_to']); $sql = "UPDATE `cosmos`.`members` SET `conf` = '2' WHERE `members`.`email` = '$email_to';"; $result=mysql_query($sql) or trigger_error(mysql_error().$sql); $count=mysql_affected_rows($result); // line 20 if($count==1){ $rows=mysql_fetch_array($result); $unique=$rows['u_code']; $name=$rows['username']; // ---------------- SEND MAIL FORM ---------------- $to=$email_to; $subject="Your Account Password Request! - Cosmos"; $header="from: Tayal's/Cosmos <cosmos@gmail.com>"; $messages= "Hey $name ,\r\n"; $messages.="You recently requested a new password"; $messages.="<br /><a href='confirm.php?uid" . $unique . "'>Confirmation Link</a> \r\n"; $sentmail = mail($to,$subject,$messages,$header); echo $messages; } else { echo "Not found your email in our database"; } }
警告:mysql_affected_rows()期望参数1为资源,在第20行的C:\ wamp \ www \ a \ l \ forget.php中给出布尔值
$result=mysql_query($sql);
至
$result=mysql_query($sql) or trigger_error(mysql_error().$sql);
并再次运行
然后
$email_to=$_POST['email_to'];
$email_to=mysql_real_escape_string($_POST['email_to']);
哦,是的,而且还有引号