Skip to content

skh6075/STMTQuery

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 

Repository files navigation

STMTQuery

Using PHP mysqli queries safely

Requirements

  • PHP Version >= 8.x

Usage

STMT library connection

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

$result = $connector->stmt_query($query,
	new STMTQueryParam(STMTQueryParam::TYPE_STRING, "steve"),
	new STMTQueryParam(STMTQueryParam::TYPE_INTEGER, 12)
);

Using queries after handling STMT parameter errors

$result = $connector->stmt_query($query,
	STMTQueryParam::safeCreate(STMTQueryParam::TYPE_STRING, "steve"),
	STMTQueryParam::safeCreate(STMTQueryParam::TYPE_INTEGER, 12)
);

Get stmt resource from STMTQueryResult

if($result->errno){
	die($result->error);
}

$stmt_query_pattern = $result->pattern;
$stmt_filter_variables = $result->values;
$mysql_result = $result->result;

About

Using PHP mysqli queries safely

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages