Skip to content

Latest commit

 

History

13 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

slimPDO

Tweaked extension for prepared statements and queries


INTRODUCTION

Just a small tweaked PDO extension for my own personal use.


SETUP INFORMATION

Use your CLI and enter the following to clone:
git clone https://github.com/thielicious/slimPDO.git


USAGE

Since it's packed in a trait called DB, you only need to use it in any class you want:

if (trait_exists("DB")) { // optional
  class some_class {
    use DB;
    // ...

Now, instead of:

$stmt = $this->pdo->prepare($sql);
$stmt->execute([":param" => $value]);

Just do this:

$this->pdo->prep($sql,[":param" => $value]);

Example:

foreach ($this->pdo->prep(
	"SELECT * FROM `members` WHERE `usr_name` = :name",
	[":name" => $username]
	) as $user) {
	return $user->usr_id;
}

This extension can be used as a callback hence very useful in loops. No separate declaration needed.



Feel free to pull/edit/fork w/e.

thielicious.github.io

About

Tweaked extension for prepared statements and queries

Topics

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages