Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/slvler/php-mysql-connectors
Mysql driver development that can be used on the php side
https://github.com/slvler/php-mysql-connectors
example mysql mysql-client mysql-connector mysql-database mysqlconnector php phpmyadmin
Last synced: 1 day ago
JSON representation
Mysql driver development that can be used on the php side
- Host: GitHub
- URL: https://github.com/slvler/php-mysql-connectors
- Owner: slvler
- License: mit
- Created: 2021-09-03T20:12:32.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2023-12-22T11:02:49.000Z (9 months ago)
- Last Synced: 2024-09-19T10:50:22.298Z (6 days ago)
- Topics: example, mysql, mysql-client, mysql-connector, mysql-database, mysqlconnector, php, phpmyadmin
- Language: PHP
- Homepage:
- Size: 28.3 KB
- Stars: 8
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.md
Awesome Lists containing this project
README
# slvler - php-mysql-connectors
[![tests](https://github.com/slvler/php-mysql-connectors/actions/workflows/tests.yml/badge.svg)](https://github.com/slvler/php-mysql-connectors)
[![Latest Stable Version](http://poser.pugx.org/slvler/mysql-connectors/v)](https://packagist.org/packages/slvler/mysql-connectors)
[![Latest Unstable Version](http://poser.pugx.org/slvler/mysql-connectors/v/unstable)](https://packagist.org/packages/slvler/mysql-connectors)
[![License](http://poser.pugx.org/slvler/mysql-connectors/license)](https://packagist.org/packages/slvler/mysql-connectors)Mysql driver development that can be used on the php side
## Installation
To install this package tou can use composer:
```bash
composer require slvler/mysql-connectors
```## Usage
```php
use slvler\mysqlconnectors\Constant;
use slvler\mysqlconnectors\Config\Method;
use slvler\mysqlconnectors\Database\DatabaseController;$Constant = new Constant();
$db = new DatabaseController($Constant->showDBHost(), $Constant->showDBName(), $Constant->showDBUser(), $Constant->showDBPassword(), $Constant->showConnection());
```
Basic Table // use northwind
------------#### table "orders"
| OrderID | EmployeeID | ShipName
|:-----------:|:------------:|:------------:|
| 10249 | 6 | red
| 10250 | 4 | yellow
| 10251 | 3 | green
| 10252 | 4 | yellow
| 10253 | 3 | red#### Insert Method (TableName, Data = array()):
TableName, Data:
```php
$tableName = "Orders";$data = Array
(
"ShipName" => "Blue",
"ShipAddress" => "Nottingham",
"ShipCity" => "UK"
);
```### Insert Method
```php
$methodInsert = $method->Insert($tableName,$data);
```
#### Update Method (TableName, Id = array() , Data = array()):
TableName, Id , Data:
```php
$tableName = "Orders";$Id = array(
"OrderID" => "1"
);$data = Array
(
"ShipName" => "Blue",
"ShipAddress" => "Nottingham",
"ShipCity" => "UK"
);
```### Update Method
```php
$methodUpdate = $method->Update($tableName', $id, $data);
```
### Delete Method (TableName, Id = array()):
TableName, Id:
```php
$tableName = "Orders";$Id = array(
"OrderID" => "1"
);```
### Delete Method
```php
$methodDelete = $method->Delete($tableName,$id);
```
### Select_all Method (TableName):
TableName:
```php
$tableName = "Orders";
```### Select_all Method
```php
$methodSelectAll = $method->Select_all($tableName);
```
### Select_ch Method (TableName, Data = array()):
TableName, Data:
```php
$tableName = "Orders";$data = Array
(
"ShipName", "ShipAddress", "ShipCity"
);```
### Select_ch Method
```php
$methodSelectCh = $method->Select_ch($tableName,$data);
```
#### Select_wh Method (TableName, Data = array(), Conn = array(), If = array()):
TableName, Data, Conn, If:
```php
$tableName = "Orders";$data = Array
(
"EmployeeID" => "4"
);$conn = Array
(
"!="
);$if = Array
(
"AND"
);```
### Select_wh Method
```php
$methodSelectWh = $method->Select_wh($tableName, $data, $conn, $if);
```
### Testing
```bash
vendor\bin\phpunit
```## Credits
- [slvler](https://github.com/slvler)
## License
The MIT License (MIT). Please see [License File](https://github.com/slvler/slvler/blob/main/LICENSE.md) for more information.