1. Go to this page and download the library: Download silverslice/easydb library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
$this->db->transaction(function () {
$this->db->query("INSERT INTO test (id, code, price) VALUES (3003, '1', 1)");
$this->db->query("INSERT INTO test (id, code, price) VALUES (3004, '1', 1)");
});
$this->db->insert('test', [
'time' => new Expression('NOW()')
]);
// or use expression alias
$this->db->insert('test', [
'time' => $this->db->expression('NOW()')
]);
multiQuery($queries)
$this->db->multiQuery("
DROP TABLE IF EXISTS `test`;
CREATE TABLE `test` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`code` char(15) NOT NULL,
`name` varchar(200) NOT NULL,
`price` decimal(10,2) unsigned DEFAULT NULL,
`order` int(11) unsigned DEFAULT 0,
PRIMARY KEY (`id`),
KEY `code` (`code`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
INSERT INTO test (id, code, name, price)
VALUES
(1, '001', 'Cup', 20.00),
(2, '002', 'Plate', 30.50)
");
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.