Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/yazinsai/php-pdo-mysql
This is a really neat Database class that allows you to easily get started with PDO statements and MySQL/PHP
https://github.com/yazinsai/php-pdo-mysql
Last synced: 7 days ago
JSON representation
This is a really neat Database class that allows you to easily get started with PDO statements and MySQL/PHP
- Host: GitHub
- URL: https://github.com/yazinsai/php-pdo-mysql
- Owner: yazinsai
- License: mit
- Created: 2013-09-01T09:13:51.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2014-08-19T04:58:18.000Z (over 10 years ago)
- Last Synced: 2025-01-11T21:53:41.462Z (15 days ago)
- Language: PHP
- Size: 171 KB
- Stars: 3
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
PHP PDO MySQL Wrapper
=====================This PHP Class makes it *ridiculously easy* to use Prepared Statements in your MySQL projects.
## How does it work?
Just start by including the class in your script:
```php
include Database.php
```
Now use it like so:```php
$DB = new Database();
$DB->query("SELECT * FROM `mytable` WHERE `myfield`=:myvalue",
array(":myvalue" => $myvalue));
$results = $DB->fetchAll();
```You now have all of the results in your `$results` variable! You can iterate through the results like so:
```php
foreach($results as $result) {
// $result contains an associative array with all the fields
echo "Result: " . $result['myfield']
}
```## Setup
Just edit the `$CONFIG` variable in the `Database.php` file with the
connection details:```php
$CONFIG = array(
"database" => array(
"host" => 'localhost',
"database" => 'database',
"username" => 'username',
"password" => 'password'
)
);
```## Why use this class?
Coz it makes yo' life a whole lot easier. And prepared statements are about 1,000,000 times more secure than plain SQL.