我遇到了Phpmyadmin的问题,因为课程作业我只是将文件转移到了ubuntu
每当我向phpmyadmin添加一个新字段时 它停止添加数据 基本上,它只接受一个字段
当你检查表数据时,它给出零结果
下面是我的代码
<!--This form links the fields to the database as well as allows inseting values to the database-->
<?php
/* Attempt MySQL server connection. Assuming you are running MySQL
server with default setting (user 'root' with no password) */
$link = mysqli_connect("localhost", "root", "password", "Pamplemousses_db");
// Check connection
if($link === false){
die("ERROR: Could not connect. " . mysqli_connect_error());
}
$Name = mysqli_real_escape_string($link, $_POST['Name']);
$Surname = mysqli_real_escape_string($link, $_POST['Surname']);
// Attempt insert query execution
$sql = "INSERT INTO Transport (Name,Surname) VALUES ('$Name','$Surname')";
if(mysqli_query($link, $sql)){
echo "Records added successfully.";
} else{
echo "ERROR: Could not able to execute $sql. " . mysqli_error($link);
}
// Close connection
mysqli_close($db_connect);
header("location:Transportbooking.php?note=success");
?>
This is my html file
<!DOCTYPE html>
<html>
<head>
<title> Transport Booking | Pamplemousses </title>
<link rel="stylesheet" href="path/to/font-awesome/css/font-awesome.min.css">
<?php include("navigation_bar.html");?>
<?
error_reporting(0);
$note=$_REQUEST['note'];
?>
</head>
<title></title>
<link rel="stylesheet" type="text/css" href="hotels.css" />
</head>
<body>
<div id="page-wrap">
<?PHP if($note=='success')
{
echo "<div class=\"success\">Form successfully submitted!</div>";
}
?>
</div>
<br/>
<form action="transport_process.php" method="post" name="Transport">
<div id="contact-area">
<div class="form-all">
<ul class="form-section page-section">
<li id="cid_1" class="form-input-wide" data-type="control_head">
<div class="form-header-group">
<div class="header-text httal htvam">
<br/>
<h2 id="header_1" class="form-header">
Book Your Transport Here
</h2>
<br/>
</div>
</div>
</li>
<li class="form-line" data-type="control_fullname" id="id_3">
<div id="cid_3" class="form-input jf-required">
<span class="form-sub-label-container" style="vertical-align: top;">
<label class="form-sub-label" for="first_3" id="sublabel_first" style="min-height: 13px;"> Name </label><br/>
<input class="form-textbox" type="text" size="10" name="Name" id="Name" aria-describedby="name-format" required/><br/>
</span>
<span class="form-sub-label-container" style="vertical-align: top;">
<label class="form-sub-label" for="last_3" id="sublabel_last" style="min-height: 13px;"> Lastname </label><br/>
<input class="form-textbox" type="text" size="15" name="Surname" id="Surname" aria-describedby="name-format" required/>
</span>
<input type="submit" value="submit">
</ul>
</div>
</form>
</body>
</html>
三个字段但只接受ID和名称:
当我删除所有内容并仅包含名称时,数据库会存储名称 但是我加姓的那一刻 它停止添加数据 请帮忙