|
|
|
ช่วยหน่อยครับ จะให้มันเช็คข้อมูลในตาราง email ห้ามซ้ำข้อมูลที่มีอยู่แล้วนะครับ |
|
|
|
|
|
|
|
Code (PHP)
<?php include '../DBconect/DbConnect.php';?>
<?
//สร้างตัวแปรเก็บค่าที่รับมาจากฟอร์ม
$email = $_REQUEST["email"];
$password = $_REQUEST["password"];
$name = $_REQUEST["name"];
$Surname = $_REQUEST["Surname"];
$Nickname = $_REQUEST["Nickname"];
$gender = $_REQUEST["gender"];
$ID_Card = $_REQUEST["ID_Card"];
$location = $_REQUEST["location"];
$province = $_REQUEST["province"];
$Tel = $_REQUEST["Tel"];
$Fax = $_REQUEST["Fax"];
$zip_code = $_REQUEST["zip_code"];
//เพิ่มเข้าไปในฐานข้อมูล
$sql = "INSERT INTO member(email, password, name, Surname, Nickname, gender, ID_Card, location, province, Tel, Fax, zip_code)
VALUES('$email', '$password', '$name', '$Surname', '$Nickname', '$gender', '$ID_Card', '$location', '$province', '$Tel', '$Fax', '$zip_code')";
if ($conn->query($sql) === TRUE) {
echo "New record created successfully";
} else {
echo "Error: " . $sql . "<br>" . $conn->error;
}
if($_POST["password"] != $_POST["Cpass"])
{
echo "Password not Match!";
exit();
}
$conn->close();
?>
Code (PHP)
<?php
$servername = "localhost";
$username = "root";
$password = "12345678";
$dbname = "monk";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
mysqli_query($conn, "SET NAMES 'utf8' ");
?>
ตรงนี้ หน้า DbConnect.php
Tag : PHP, HTML, JavaScript, Web (ASP.NET)
|
|
|
|
|
|
Date :
2018-02-13 12:48:13 |
By :
backmonkbk |
View :
826 |
Reply :
2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 01
|