https://github.com/skh6075/stmtquery
Using PHP mysqli queries safely
https://github.com/skh6075/stmtquery
Last synced: 3 months ago
JSON representation
Using PHP mysqli queries safely
- Host: GitHub
- URL: https://github.com/skh6075/stmtquery
- Owner: skh6075
- License: mit
- Created: 2023-05-16T06:26:04.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2023-05-16T12:35:04.000Z (about 2 years ago)
- Last Synced: 2025-01-11T04:35:40.478Z (4 months ago)
- Language: PHP
- Size: 19.5 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# STMTQuery
Using PHP mysqli queries safely## Requirements
* PHP Version >= ```8.x```## Usage
### STMT library connection
```php
require_once "/your/library/path/STMTQuery/STMTConnector.php";$connector = STMTConnector::connect('hostname', 'username', 'password', 'database');
$query = " SELECT user_name FROM member_tb WHERE `user_email` = ? AND `user_age` = ? LIMIT 1 ";
```### Using the STMT Query Syntax Library Format
```php
$result = $connector->stmt_query($query,
new STMTQueryParam(STMTQueryParam::TYPE_STRING, "steve"),
new STMTQueryParam(STMTQueryParam::TYPE_INTEGER, 12)
);
```### Using queries after handling STMT parameter errors
```php
$result = $connector->stmt_query($query,
STMTQueryParam::safeCreate(STMTQueryParam::TYPE_STRING, "steve"),
STMTQueryParam::safeCreate(STMTQueryParam::TYPE_INTEGER, 12)
);
```### Get stmt resource from STMTQueryResult
```php
if($result->errno){
die($result->error);
}$stmt_query_pattern = $result->pattern;
$stmt_filter_variables = $result->values;
$mysql_result = $result->result;
```