我正在尝试将信息上传到数据库。我创建的页面是注册页面,用户可以在其中输入电子邮件用户名和密码。以下代码是我编写的数据库连接和上传代码。但我不断收到上述错误。有人可以告诉我我在想什么吗?
<?php
$db_host=
$db_username=
$db_pass=
$db_name=
$connectToServer =mysqli_query($host,$db_username,$db_pass) or die("server problem");
$selectDb =mysqli_select_db($connectToServer,$db_name) or die("database not found");
if(isset($_POST['submit'])) {
$username=$_POST['username'];
$email=$_POST['eml'];
$password =$_POST['password'];
if(!empty($username)&&!empty($email)&&!empty($password)) {
$username = striplashes($username);
$email=striplashes($email);
$password=striplashes($password);
$username = mysql_real_escape_string($connectToServer,$username);
$selectTable = "SELECT * FROM user_info WHERE username='$username'"
$query = mysqli_query($connectToServer,$selectTable);
$insert = "INSERT INTO user_info (username, email, password) VALUES ($username, $eml, $password)"
$mquery = mysqli_query($connectToServer,,$insert);
if ($mquery) {
session_start();
$_SESSION['login_user'] =$username ;
header("Location ; profile.php");
}
}
else {
echo <script>('please enter details')</script>;
header("Location: register.html");
}
}
?>
答案 0 :(得分:-1)
您在第22行缺少分号:
$selectTable = "SELECT * FROM user_info WHERE username='$username'"; // <- here
与第24行相同。
第25行上有一个多余的逗号... 而且您在第34行上缺少双引号...