https://github.com/thipages/quicksql
Quick sql builder
https://github.com/thipages/quicksql
delete insert php quick select update
Last synced: 10 months ago
JSON representation
Quick sql builder
- Host: GitHub
- URL: https://github.com/thipages/quicksql
- Owner: thipages
- License: mit
- Created: 2020-04-05T14:33:45.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2023-01-27T15:13:51.000Z (about 3 years ago)
- Last Synced: 2025-03-10T20:18:26.271Z (11 months ago)
- Topics: delete, insert, php, quick, select, update
- Language: PHP
- Size: 15.6 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# quicksql
Quick sql builder
### Installation
**composer** require thipages\quicksql OR use the single php file **quicksql.php**
### Usage of QSql class
#### Through the following static methods (more to come)
```php
insert ($tableName, $keyValues)
insert ($tableName, $keyValues, $values)
update ($tableName, $keyValues, $where)
delete ($tableName, $where)
```
#### Examples
```php
$sql=QSql::insert(
"aTable",
[
'field1'=>1
'field2'=>2
]
);
/* INSERT INTO aTable ( field1,field2 ) VALUES ( '1', '2' ); */
$sql=QSql::insert(
"aTable",
['field1','field2'],
[
[1,2],
[3,4]
]
);
/* INSERT INTO aTable ( field1,field2 ) VALUES ( '1','2' ),( '3','4' ); */
$sql=QSql::update(
"aTable",
[
'field1'=>1,
'field2'=>2
],
"id=1"
);
/* UPDATE aTable SET field1='1',field2='2' WHERE id=1; */
$sql=QSql::delete("aTable","id=1");
/* DELETE FROM aTable WHERE id=1; */
```