2017 © Pedro PelĂĄez
 

library pdo-database

A super simple function that returns the full SQL query from your PDO statements

image

stnc/pdo-database

A super simple function that returns the full SQL query from your PDO statements

  • Monday, September 18, 2017
  • by stnc
  • Repository
  • 1 Watchers
  • 1 Stars
  • 19 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 5 Open issues
  • 12 Versions
  • 0 % Grown

The README.md

pdo-database

easy ,basic ,simple mysql provider
A super simple function that returns the full SQL query from your PDO statements
a PDO database service provider for mysql and portgreSQL, (*1)

Composer install

composer require stnc/pdo-database, (*2)

1. Installing-Connections

require_once 'vendor/autoload.php';
  define('DB_TYPE', 'mysql');
  define('DB_HOST', 'localhost');
  define('DB_NAME', 'wordpress');
  define('DB_USER', 'root');
  define('DB_PASS', '');
  ```
## 2. Connections
```php
/* //use 1 
use Stnc\Db\MysqlAdapter ;
$db = new MysqlAdapter();
*/

/* //use 2
use Stnc\Db\MysqlAdapter as dbs;
$db = new dbs();
*/


//use 3
$db = new Stnc\Db\MysqlAdapter();
$tableName = 'users';

3. Select multiple rows

$q = "SELECT * FROM ".$tableName;
$array_expression = $db->fetchAll ( $q );
foreach ( $array_expression as $value ) {
    echo  $value ['name'];
    echo '<br>';
}

4. Select single row

$tableName = 'wp_options';//wordpress 
$q = "SELECT * FROM ".$tableName;
$array_expression = $db->fetch ( $q );
echo $array_expression ['name'];
//or 
$q = 'SELECT * FROM '.$tableName.' where option_name="siteurl" ';
$array_expression = $db->fetch ( $q );
print_r ($array_expression);
echo $array_expression ['option_name'];


5. Query

$q = "ALTER TABLE users MODIFY COLUMN user_id  int(11) NOT NULL AUTO_INCREMENT FIRST";
$db->query ( $q );

6. insert data

$data = array (
        'name' => "john",
        'lastname' => "carter",
        'status' => 1,
        'age' => 25 
);


$db->insert ( $tableName, $data );

7. update metod

$data = array (
        'name' => "john",
        'lastname' => "carter",
        'status' => 1,
        'age' => 25 
);
$where = array (
        'user_id' => 1 
);
$db-> update ( $tableName, $data, $where );

8. Delete metod

$where = array (
        'user_id' => 1 
);

return $db->delete ( $tableName, $where );

9. last id

$db->lastID();

10. Orm Mass Updates

$db->tableName=$tableName;
$db->where('id', '=', 1)->update2(['username' =>'selman sedat']);

The Versions

18/09 2017

dev-master

9999999-dev https://github.com/stnc/pdo-database

A super simple function that returns the full SQL query from your PDO statements

  Sources   Download

MIT

The Requires

  • php >=5.4.0
  • ext-pdo *

 

sql pdo mysql

21/05 2017

2.1.0

2.1.0.0 https://github.com/stnc/pdo-database

A super simple function that returns the full SQL query from your PDO statements

  Sources   Download

MIT

The Requires

  • php >=5.4.0
  • ext-pdo *

 

sql pdo mysql

21/05 2017

2.0.9

2.0.9.0 https://github.com/stnc/pdo-database

A super simple function that returns the full SQL query from your PDO statements

  Sources   Download

MIT

The Requires

  • php >=5.4.0
  • ext-pdo *

 

sql pdo mysql

21/05 2017

2.0.8

2.0.8.0 https://github.com/stnc/pdo-database

A super simple function that returns the full SQL query from your PDO statements

  Sources   Download

MIT

The Requires

  • php >=5.4.0
  • ext-pdo *

 

sql pdo mysql

21/05 2017

2.0.6

2.0.6.0 https://github.com/stnc/pdo-database

A super simple function that returns the full SQL query from your PDO statements

  Sources   Download

MIT

The Requires

  • php >=5.4.0
  • ext-pdo *

 

sql pdo mysql

21/05 2017

2.0.7

2.0.7.0 https://github.com/stnc/pdo-database

A super simple function that returns the full SQL query from your PDO statements

  Sources   Download

MIT

The Requires

  • php >=5.4.0
  • ext-pdo *

 

sql pdo mysql

21/05 2017

2.0.5

2.0.5.0 https://github.com/stnc/pdo-database

A super simple function that returns the full SQL query from your PDO statements

  Sources   Download

MIT

The Requires

  • php >=5.4.0
  • ext-pdo *

 

sql pdo mysql

21/05 2017

2.0.4

2.0.4.0 https://github.com/stnc/pdo-database

A super simple function that returns the full SQL query from your PDO statements

  Sources   Download

MIT

The Requires

  • php >=5.4.0
  • ext-pdo *

 

sql pdo mysql

21/05 2017

2.0.3

2.0.3.0 https://github.com/stnc/pdo-database

A super simple function that returns the full SQL query from your PDO statements

  Sources   Download

MIT

The Requires

  • php >=5.4.0
  • ext-pdo *

 

sql pdo mysql

21/05 2017

2.0.2

2.0.2.0 https://github.com/stnc/pdo-database

A super simple function that returns the full SQL query from your PDO statements

  Sources   Download

MIT

The Requires

  • php >=5.4.0
  • ext-pdo *

 

sql pdo mysql

20/05 2017

2.0.1

2.0.1.0 https://github.com/stnc/pdo-database

A super simple function that returns the full SQL query from your PDO statements

  Sources   Download

MIT

The Requires

  • php >=5.4.0
  • ext-pdo *

 

sql pdo mysql

06/08 2015

2.0.0

2.0.0.0 https://github.com/stnc/pdo-database

A super simple function that returns the full SQL query from your PDO statements

  Sources   Download

MIT

The Requires

 

sql pdo mysql