以下代码中的第107行是
$sql="INSERT INTO " $table_name " (confirm_code,name,password,email,address,phone,education,date_of_birth) VALUES
('".$confirm_code."','".$name."','".$pwd."','".$email."','".$adres."','".$phno."','".$educon."','".$dob."') "; "
Run Code Online (Sandbox Code Playgroud)
我得到了意想不到的T_VARIABLE;
<?php
if(isset($_POST['Register']))
{
$name= $_POST['uname'];
$pwd= $_POST['pswd'];
$email= $_POST['email'];
$phno= $_POST['phno'];
$adrs= str_replace("'","`",$_POST['adres']);
$adres = $adrs;
$educon= $_POST['educon'];
$dob= $_POST['dob'];
$chkname = "select email from ".USREG." where email='".$email."'";
$res = mysql_query($chkname, $con) or die(mysql_error());
$chkresult=mysql_fetch_array($res);
$uemail= $chkresult['email'];
//print_r($uemail);die();
include ('config.php');
$table_name=temp_members_db;
$confirm_code=md5(uniqid(rand()));
if($uemail==$email)
{
echo ' <p style="color:red">Email <b> '.$email.' </b> Already exists</p>';
}
else
{
$sql="INSERT INTO " $table_name "(confirm_code,name,password,email,address,phone,education,date_of_birth) VALUES
('".$confirm_code."','".$name."','".$pwd."','".$email."','".$adres."','".$phno."','".$educon."','".$dob."') ";
$result = mysql_query($sql, $con) or die(mysql_error());
if($result)
{
$to=$email;
echo '<p style="color:green"> '.$name.' Your Registration Success</p> <br/>';
$subject = "your confirmation link here";
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$header = 'From: ShareLibrary <'.ADMIN_MAIL.'>' . "\r\n";
$admMesg = $email." is registered ";
$message = "your confrimation link \r\n";
$message = "click on this link to activae your account \r\n";
$message = "http://www.xxxxxx.in/confirmation.php?passkey=$confirm_code";
$sentmail = $mail($to,$subject,$message,$header);
if($sentmail)
{
echo '<p style="color:green">registration details sent to '.$email.' </p><br/>';
}
else
{
echo '<p style="color:red">registration details sending to your mail was failed';
}
}
else
{
echo "<p>Registration FAILED</p>";
}
}
}
?>
Run Code Online (Sandbox Code Playgroud)
以上代码是用于注册完成后的用户注册表单,激活码将转到用户注册的邮箱ID.
我知道T_VARIABLE错误的发生主要是由于错误显示的前一行缺少分号或大括号.但我认为我用分号结束前一行,我不会错过任何大括号.但我仍然得到这个意外的t_variable错误我不知道它为什么会来.请任何人帮我解决这个问题
你错过了连接运算符:
$sql="INSERT INTO " $table_name "(confi
^^^^^ ^^^^^
HERE HERE
Run Code Online (Sandbox Code Playgroud)
它应该是
$sql="INSERT INTO " . $table_name . "(confi
Run Code Online (Sandbox Code Playgroud)
PHP也应该警告你$table_name=temp_members_db;.
你错过了字符串值的引号,如果没有引用temp_members_db,它会被视为/视为常量.
$table_name='temp_members_db';
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4217 次 |
| 最近记录: |