亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

PHP development message board tutorial database

Database creation

The code below creates a database named "message"

Character encoding is "utf8"

<?php
header("Content-type:text/html;charset=utf-8");    //設(shè)置編碼
$servername = "localhost";
$username = "root";
$password = "root";
// 創(chuàng)建連接
$conn = mysqli_connect($servername, $username, $password);
 mysqli_set_charset($conn,'utf8'); //設(shè)定字符集 
// 檢測(cè)連接
if (!$conn) {
    die("連接失敗: " . mysqli_connect_error());
}
// 創(chuàng)建數(shù)據(jù)庫
$sql = "CREATE DATABASE message";
if (mysqli_query($conn, $sql)) {
    echo "數(shù)據(jù)庫創(chuàng)建成功";
} else {
    echo "數(shù)據(jù)庫創(chuàng)建失敗: " . mysqli_error($conn);
}
mysqli_close($conn);
?>

Data table creation

The following code creates the name It is the data table of 'Ressage_user'. The fields are as follows

##Field nameidnameemailcontentressage_timeField typeINTVARCHARVARCHARVARCHARDATEField length63050200##Field Description
<?php
header("Content-type:text/html;charset=utf-8");    //設(shè)置編碼
$servername = "localhost";
$username = "root";
$password = "root";
$dbname = "ressage";
// 創(chuàng)建連接
$conn = mysqli_connect($servername, $username, $password, $dbname);
mysqli_set_charset($conn,'utf8'); //設(shè)定字符集 
// 檢測(cè)連接
if (!$conn) {
    die("連接失敗: " . mysqli_connect_error());
}
// 使用 sql 創(chuàng)建數(shù)據(jù)表
$sql = "CREATE TABLE Ressage_user (
 id INT(6) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
 name VARCHAR(30) NOT NULL,
 email VARCHAR(50) NOT NULL,
 content VARCHAR(200) NOT NULL,
 ressage_time DATE
 );";
if (mysqli_query($conn, $sql)) {
    echo "數(shù)據(jù)表 user 創(chuàng)建成功";
} else {
    echo "創(chuàng)建數(shù)據(jù)表錯(cuò)誤: " . mysqli_error($conn);
}
mysqli_close($conn);
?>
? ? ? ?
? ? ? ?







User The idThe name of the messageThe email address filled in the messageThe content of the messageThe message time

Continuing Learning
||
<?php header("Content-type:text/html;charset=utf-8"); //設(shè)置編碼 $servername = "localhost"; $username = "root"; $password = "root"; // 創(chuàng)建連接 $conn = mysqli_connect($servername, $username, $password); mysqli_set_charset($conn,'utf8'); //設(shè)定字符集 // 檢測(cè)連接 if (!$conn) { die("連接失敗: " . mysqli_connect_error()); } // 創(chuàng)建數(shù)據(jù)庫 $sql = "CREATE DATABASE message"; if (mysqli_query($conn, $sql)) { echo "數(shù)據(jù)庫創(chuàng)建成功"; } else { echo "數(shù)據(jù)庫創(chuàng)建失敗: " . mysqli_error($conn); } mysqli_close($conn); ?>
submitReset Code