-6ren">
gpt4 book ai didi

php - 当页面加载 php 错误时,与服务器的连接被重置

转载 作者:搜寻专家 更新时间:2023-10-30 23:41:07 25 4
gpt4 key购买 nike

<?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>

从那以后一直坚持那个错误信息。无法找出我的连接或代码哪里出了问题。有人介意帮我吗?真的想不出我的错误在哪里。根本无法判断是连接问题还是代码问题。

最佳答案

您已在代码中添加了这一行。 header('位置:login.php');

这意味着页面将重定向到 login.php。如果你将上面的页面命名为 login.php 那么就会形成一个重定向循环(再次重定向到同一页面)。因此浏览器无法呈现该页面。

关于php - 当页面加载 php 错误时,与服务器的连接被重置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35099133/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com