mysqli类的PHP包装器

v1 2023-04-09 21:07 UTC

This package is auto-updated.

Last update: 2024-09-10 00:58:43 UTC


README

PHP MySQLi 扩展的包装器

要求

  • PHP ^7.3

安装

使用composer安装,请运行以下命令

composer require codeboxsql/php

用法

//Autoload classes using composer
require_once 'vendor/autoload.php';
//OR
//Include the classes directly from path
require_once 'vendor/codeboxsql/php/dist/mysql.php';

$host = 'localhost';
$user = 'root';
$pass = '';
$database = 'test';

$mysqli = new codeboxsql\mysql($host, $user, $pass, $database);

//INSERT
$mysqli->insertInto('tableOne',array('name' => 'lolo' , 'deg' => '100')); //return string

//SELECT
//Single Select
$mysqli->singleSelect('accounts',array('id' => '60' , 'mobile' => '+2348023775657'), 'fetch', array('ORDER BY' => 'rand()' , 'LIMIT' => '3')); //return array
$mysqli->singleSelect('accounts',array('id' => '60' , 'mobile' => '+2348023775657'), 'count', array('ORDER BY' => 'rand()' , 'LIMIT' => '3')); //return string
//multi Select
$mysqli->multiSelect(array('accounts' => 'a' , 'bvn' => 'b'),array('a.id' => '60' , 'b.usrID' => '60'), 'fetch', array('ORDER BY' => 'rand()' , 'LIMIT' => '3'));// return array
//$mysqli->multiSelect(array('accounts' => 'a' , 'bvn' => 'b'),array('a.id' => '60' , 'b.usrID' => '60'), 'count', array('ORDER BY' => 'rand()' , 'LIMIT' => '3')); //return string

示例

请在浏览器中查看examples.php文件中的脚本。

贡献

如果您遇到错误或有一些建议可以帮助改进这个库以供他人使用,欢迎您在GitHub上为本存储库打开一个问题,我们的开发团队将进行审核。

许可

MIT - 查看 LICENSE