|
|
|
ข้อมูลไม่เข้า database ครับปัญหาเกิดขึ้นจากอะไรครับ |
|
|
|
|
|
|
|
Code (PHP)
<?php
//ตืดต่อฐานข้อมูล
?>
<?php
$link = mysqli_connect("localhost","root","","chinjung");
mysqli_select_db($link,"register_td");
$username = $_POST['username'];
$password = $_POST['password'];
$Firstname = $_POST['Firstname'];
$Lastname = $_POST['Lastname'];
$telephone = $_POST['telephone'];
$email = $_POST['email'];
$sql = "INSERT INTO register_td(username,password,Firstname,Lastname,telephone,email) "
. "VALUES('$username','$password,'$Firstname','$Lastname','$telephone,'$email',)";
$objQuery = mysqli_query($link,$sql);
echo "เพิ่มข้อมูลเรียบร้อยแล้ว";
?>
Code (PHP)
<?php
$hostname = 'localhost';
$username = 'root';
$password = '';
$database = 'chinjung';
$connect = new mysqli($hostname, $username, $password, $database);
if ($connect->connect_error){
echo "chinjung";
}
?>
Code (PHP)
<html>
<head>
<title>Register</title>
<link rel="stylesheet" type="text/css" href="work/css/style1.css">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<style type="text/css">
body
{
background: url(picture/bg_1.jpg) no-repeat center center fixed;
background-size: cover;
}
</style>
<div class="registerbox">
<form name="save_register.php" method="post" action="save_register.php">
<img src="picture/user_m.png" class="avatar">
<h1> Register Here</h1>
<p>Username</p>
<input type="username" name="username">
<p>Password</p>
<input type="password" name="password">
<p>Firstname</p>
<input type="Firstname" name="Firstname">
<p>Lastname</p>
<input type="Lastname" name="Lastname">
<p>Telephone</p>
<input type="telephone" name="telephone">
<p>E-mail</p>
<input type="email" name="email">
<input type="submit" name="btn_submit" value="Save">
</form>
</div>
</body>
</html>
Tag : PHP, XAMPP, Windows
|
|
|
|
|
|
Date :
2018-08-20 08:42:51 |
By :
790036471203806 |
View :
659 |
Reply :
3 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Code (PHP)
<?php
//ตืดต่อฐานข้อมูล
?>
<?php
$link = mysqli_connect("localhost","root","","chinjung");
mysqli_select_db($link,"register_td");
$username = $_POST['username'];
$password = $_POST['password'];
$Firstname = $_POST['Firstname'];
$Lastname = $_POST['Lastname'];
$telephone = $_POST['telephone'];
$email = $_POST['email'];
$sql = "INSERT INTO register_td(username,password,Firstname,Lastname,telephone,email) "
. "VALUES('$username','$password,'$Firstname','$Lastname','$telephone,'$email',)";
$objQuery = mysqli_query($link,$sql);
echo "เพิ่มข้อมูลเรียบร้อยแล้ว";
?>
Code (PHP)
$link = mysqli_connect("localhost","root","","chinjung");
mysqli_query($link,"set name utf8");
if(!$link){
die("Error connect".mysqli_connect_error());
}
$sql = " INSERT INTO register_td(username,
password,
Firstname,
Lastname,
telephone,
email)
VALUES('$username',
'$password',
'$Firstname',
'$Lastname',
'$telephone',
'$email'
)";
$objQuery = mysqli_query($link,$sql) or die ("Error row::".mysqli_error($link));
if($objQuery){
echo "<script>alert('Save done'); <script>";
}
Basic น่ะครับ ไปอ่าน mysqli_connect และ Check ' " , ..... และวิธีการเขียนให้อ่าน Code ง่ายๆ
|
ประวัติการแก้ไข 2018-08-20 09:09:14 2018-08-20 10:47:47
|
|
|
|
Date :
2018-08-20 09:07:46 |
By :
Hararock |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ขอบคุณครับ ตอนนี้ข้อมูลเข้าและครับ
|
|
|
|
|
Date :
2018-08-20 09:50:38 |
By :
790036471203806 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 02
|