woottipong523 / mysqliclassdb
简单的数据库连接 (MySQLi)
v1.0.5
2019-02-15 05:25 UTC
Requires
- php: >=7.0
This package is not auto-updated.
Last update: 2024-09-29 05:42:13 UTC
README
简单的数据库连接 (MySQLi)
安装
开始之前,请安装 PHP 依赖管理器 Composer。
现在来安装这个组件
composer require woottipong523/mysqliclassdb
示例
require 'vendor/autoload.php';
$db = new DB('user', 'password', 'database', 'host');
// 插入 $result = $db->query("insert into customer (username, password, email, address, dateAdd) values ('woottipong', '123456', 'woottipong523@psru.ac.th', 'M1', now())");
$last_id = $db->lastid;
// 查询
$result = $db->query("select * from customer");
print_r($result);
// 更新
$result = $db->query("update customer set address = '123' where customer_id = '1'");
// 删除
$db->query("delete from customer where customer_id = '1'");
// 断开连接
$db->disconnect();