woottipong523 / mysqliclassdb
Easy database connection (MySQLi)
Requires
- php: >=7.0
This package is not auto-updated.
Last update: 2025-06-22 09:31:40 UTC
README
Easy database connection (MySQLi)
Installation
To begin, install the preferred dependency manager for PHP, Composer.
Now to install just this component:
composer require woottipong523/mysqliclassdb
Sample
require 'vendor/autoload.php';
$db = new DB('user', 'password', 'database', 'host');
// insert
$result = $db->query("insert into customer (username, password, email, address, dateAdd) values ('woottipong', '123456', 'woottipong523@psru.ac.th', 'M1', now())");
$last_id = $db->lastid;
// select
$result = $db->query("select * from customer");
print_r($result);
// update
$result = $db->query("update customer set address = '123' where customer_id = '1'");
// delete
$db->query("delete from customer where customer_id = '1'");
// disconnect
$db->disconnect();