Unknown column 'usernameที่กรอกลงไป' in 'field list'
อันนี้คือหน้าฟอร์มที่กรอกค่ะ
https://www.img.in.th/image/DMSYEc
databaseที่เชื่อมค่ะ
https://www.img.in.th/image/DMSskY
config.php
[Spoil] คลิกเพื่อดูข้อความที่ซ่อนไว้<?php
$server = "localhost";
$user = "root";
$password = "";
$dbname = "j2w";
$connect = mysqli_connect($server, $user, $password, $dbname);
if (!$connect)
{
die ("ERROR: Cannot connect to the database $dbname on $server
using username $user (" .mysqli_connect_errno(). ", ".mysqli_connect_error(). ")");
}
mysqli_query($connect, "SET NAMES utf8");
?>
register.html
[Spoil] คลิกเพื่อดูข้อความที่ซ่อนไว้<!DOCTYPE html>
<html>
<head>
<title>J2W Register</title>
<body>
<h1>Register Form</h1> <br>
<table width="400" border="0" style="width: 400px">
<form action="save_regis.php" method="post" >
<tr>
<td width="125">Username</td>
<td width="180">
<input name="username" type="text" id="username" size="20">
</td>
</tr>
<tr>
<td>Password</td>
<td><input name="password" type="password" id="password">
</td>
</tr>
<tr>
<td>Confirm Password</td>
<td><input name="conPassword" type="password" id="conPassword">
</td>
</tr>
<tr>
<td>Name</td>
<td><input name="name" type="text" id="name" size="35"></td>
</tr>
<tr>
<td>Last Name</td>
<td><input name="lastname" type="text" id="lastname" size="35"></td>
</tr>
<tr>
<td><input type="submit" name="Submit" value="Save"></td>
<td></td>
</tr>
<br>
</form>
</table>
</body>
</html>
save_regis.php
[Spoil] คลิกเพื่อดูข้อความที่ซ่อนไว้<?php
require_once "config.php";
$username = $_POST["username"];
$password = $_POST["password"];
$name = $_POST["name"];
$lastname = $_POST["lastname"];
if(($username) == "")
{
echo "Please input Username!";
exit();
}
if(($password) == "")
{
echo "Please input Password!";
exit();
}
if($password != $_POST["conPassword"])
{
echo "Password not Match!";
exit();
}
if(($name) == "")
{
echo "Please input Name!";
exit();
}
if(($lastname) == "")
{
echo "Please input Last name!";
exit();
}
$userQuery = "INSERT INTO `member` (userID,username,`password`,`name`,lastname)
VALUES (null,$username, $password, $name, $lastname)";
$result = mysqli_query($connect, $userQuery);
if (!$result)
{
die ("Could not successfully run the query $userQuery ".mysqli_error($connect));
}
else
{
echo "Register Completed!<br>";
echo "<br> Go to <a href='login.php'>Login page</a>";
}
mysqli_close($connect);
?>
ช่วยแก้เออเร่อหน่อยค่ะ
อันนี้คือหน้าฟอร์มที่กรอกค่ะ https://www.img.in.th/image/DMSYEc
databaseที่เชื่อมค่ะ https://www.img.in.th/image/DMSskY
config.php
[Spoil] คลิกเพื่อดูข้อความที่ซ่อนไว้
register.html
[Spoil] คลิกเพื่อดูข้อความที่ซ่อนไว้
save_regis.php
[Spoil] คลิกเพื่อดูข้อความที่ซ่อนไว้