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: 5 months 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 (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2024-10-20T09:41:50.000Z (9 months ago)
- Last Synced: 2025-01-31T22:11:43.355Z (5 months 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
# php-mysql-connectors
[](https://github.com/slvler/php-mysql-connectors)
[](https://packagist.org/packages/slvler/mysql-connectors)
[](https://packagist.org/packages/slvler/mysql-connectors)
[](https://packagist.org/packages/slvler/mysql-connectors)
[](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.