php-无法显示网站
下面是代码php-无法显示网站,php,Php,下面是代码 <? include('config.php'); // table name $tbl_name=temp_members_db; // Random confirmation code $confirm_code=md5(uniqid(rand())); // values sent from form $name=$_POST['name']; $email=$_POST['email']; $country=$_POST['country']; // I
<?
include('config.php');
// table name
$tbl_name=temp_members_db;
// Random confirmation code
$confirm_code=md5(uniqid(rand()));
// values sent from form
$name=$_POST['name'];
$email=$_POST['email'];
$country=$_POST['country'];
// Insert data into database
$sql="INSERT INTO $tbl_name(confirm_code, name, email, password, country)VALUES('$confirm_code', '$name', '$email', '$password', '$country')";
$result=mysql_query($sql);
// if suceesfully inserted data into database, send confirmation link to email
if($result){
// ---------------- SEND MAIL FORM ----------------
// send e-mail to ...
$to=$email;
// Your subject
$subject="Your confirmation link here";
// From
$header="from: your name <your email>";
// Your message
$message="Your Comfirmation link \r\n";
$message.="Click on this link to activate your account \r\n";
$message.="http://www.yourweb.com/confirmation.php?passkey=$confirm_code";
// send email
$sentmail = mail($to,$subject,$message,$header);
}
// if not found
else {
echo "Not found your email in our database";
}
// if your email succesfully sent
if($sentmail){
echo "Your Confirmation link Has Been Sent To Your Email Address.";
}
else {
echo "Cannot send Confirmation link to your e-mail address";
}
?>
在您的行中$tbl\u name=temp\u members\u db
--temp\u members\u db是一个定义的常量(通过config.php中的define('temp\u members\u db','some\u value')
),还是应该是一个字符串?还是一个变量名?这可能是您忽略的问题…将这些行添加到代码顶部:
ini_set('diplay_errors', 'on');
error_reporting(-1);
您将看到什么也不显示的原因
此外,添加echo mysql\u error()
以查看有关查询错误的信息:
$result=mysql_query($sql);
echo mysql_error();
temp\u members\u db
是常数吗?如果不是,请用引号括起来:
'temp_members_db'
确保使用完整的源代码/apache日志中是否有错误消息?请尽可能准确地描述您的问题。到底是什么问题?也许您需要使用完整的PHP标签网站上没有显示任何内容确保启用错误报告,它会告诉您问题所在。您不知道吗se短标记,即使它们已启用。请自便!首先删除所有代码,并使用回显“Hello world!”进行测试