所以我试图做看起来应该做的事情,而且可能是一个非常简单的平凡任务。我正在尝试检查我的数据库中的电子邮件地址。我不知道我是否走在正确的轨道上,有人能把我逼出来吗?
$query = "SELECT * FROM 68_users WHERE email= $email";
if($result = mysqli_query($link, $query) == $email) {
echo 'Email has been registered';
}else{
$query = "INSERT INTO 68_users (email,pass,old_pass,first_name,last_name,dob,gender,phone,fanmail)
VALUES ('$email',AES_ENCRYPT('$pass', 'something'),AES_ENCRYPT('$pass', 'something'),'$first_name','$last_name','$dob','$gender','$phone','$fanmail')"
or die(mysqli_error());
if ( !mysqli_query($link, $query) ) {
echo 'error: '.mysqli_error($link);
exit();
}
}
mysqli_close($link);
}
谢谢大家的帮助。我需要弄清楚 php 的调试情况。现在我在 Eclipse 中编写并在我的网站上进行调试,非常令人恼火..这就是我使用的:
$query = "SELECT * FROM 68_users WHERE email= '$email'";
$result = mysqli_query($link, $query);
if($result->num_rows > 0) {
echo 'This email has previously been registered';
}else{
$query = "INSERT INTO 68_users (email,pass,old_pass,first_name,last_name,dob,gender,phone,fanmail)
VALUES ('$email',AES_ENCRYPT('$pass', 'something'),AES_ENCRYPT('$pass', 'something'),'$first_name','$last_name','$dob','$gender','$phone','$fanmail')"
or die(mysqli_error());
if ( !mysqli_query($link, $query) ) {
echo 'error: '.mysqli_error($link);
exit();
}
header( 'Location: http://www.example.com/html/thankyou.html' ) ;
}