Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/titikterang/php_simple_crud_helper
Simple database crud helper based on php
https://github.com/titikterang/php_simple_crud_helper
crud mysql php sql
Last synced: 5 days ago
JSON representation
Simple database crud helper based on php
- Host: GitHub
- URL: https://github.com/titikterang/php_simple_crud_helper
- Owner: titikterang
- Created: 2019-06-12T03:50:55.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2019-06-12T09:01:24.000Z (over 5 years ago)
- Last Synced: 2024-05-11T17:52:16.591Z (6 months ago)
- Topics: crud, mysql, php, sql
- Language: PHP
- Homepage:
- Size: 8.79 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# php simple crud helper
___
Simple mysql database crud helper### insert
Insert data into table
```
$tool = new dbaseTools();
$data["id"] = "USER01";
$data["username"] = "xander";
$data["pass"] = "nothing";
$tool->insert("user_table", $data);
```### update by PK
Update table by primary key
```
$tool = new dbaseTools();
$id = 'USER01';
$data["username"] = "xander";
$data["pass"] = "new_pas";
$tool->updateByPK("user_table", $data, $id);
```### delete by PK
Delete row by primary key
```
$tool = new dbaseTools();
$id = 'user01';
$tool->deleteByPK("user_table", $id);
```### query
regular mysql query with where clause
```
$tool = new dbaseTools();
$query = "select * from user_table where id = :id and status = :status";
$param = array("id"=>2, "status"=>0);
$tool->query($query, $param);
```### generate php classes from table
generate classes from all existing tables
```
$tools = new dbaseTools();
$tools->generateClassFromAllTable("models");
```generate classes from single table
```
$tools = new dbaseTools();
$tools->generateClassFromTableName("t_user_login", "models");
```generate classes from table in array
```
$tools = new dbaseTools();
$listTables = ["t_user_login", "t_user_history"];
$tools->generateClassFromTables($listTables, "models");
```