【发布时间】:2016-01-30 07:12:37
【问题描述】:
<?php
session_start();
include 'dbConnection.php';
?>
<!DOCTYPE HTML>
<html>
<head>
<title>Online Book Club</title>
</head>
<body>
<form method ="post" action ="register.php">
<?php
//get the values from the form, using the POST method.
$first_name = $_POST['first_name'];
$last_name = $_POST['last_name'];
$profession = $_POST['profession'];
$gender = $_POST['gender'];
$date_of_birth = $_POST['date_of_birth'];
$country_of_residence = $_POST['country_of_residence'];
$email = $_POST['first_name'];
$username = $_POST['username'];
$password = $_POST['password'];
$query = "SELECT username FROM account WHERE username = '$username' ";
$result = mysqli_query($link, $query) ;
$queryInsert = "INSERT INTO user (first_name,last_name,profession,gender,date_of_birth,country_of_residence,email,username,password)" .
"VALUES ('$first_name', '$last_name', '$profession', '$gender', '$date_of_birth', '$country_of_residence', '$email', '$username', '$password')";
//echo $queryInsert;
//echo $queryInsert;
$resultInsert = mysqli_query($link,$queryInsert);
header('Location: login.php');
echo "<h3>The following user has been successfully added: </h3>";
?>
Click <a href="admin.php"> here </a> to go back to the home page.
</body>
</html>
一直被该错误消息困扰。无法找出我的连接或代码哪里出了问题。有人介意帮助我吗?真的想不出我的错误在哪里。根本无法判断是连接问题还是代码问题。
【问题讨论】:
-
它不是
include 'dbConnection.php';。将其更改为include('dbConnection.php'); -
嗯,我做了相应的更改,但仍然有同样的错误
-
<form method ="post" action ="register.php">在那里做什么?与include 'dbConnection.php';一起分享您的完整代码。请。 -
您遇到了什么错误?也请粘贴您的错误。