blob: 8787da32a51024798d1bbe2e93590ae6f861fccb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
<?php require_once 'config.php'?>
<?php
global $conn;
function execute_sql($sql) {
global $conn;
if($conn == NULL){
// 创建连接
$conn = new mysqli(Config::$servername, Config::$username, Config::$password, Config::$db_name);
// 检测连接
if ($conn->connect_error) {
die("连接失败: " . $conn->connect_error);
return ;
}
}
return mysqli_query($conn, $sql);
}
function get_last_insert_id() {
global $conn;
return mysqli_insert_id($conn);
}
?>
|