PHP code example of turbopixel / phpdo-database

1. Go to this page and download the library: Download turbopixel/phpdo-database library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

turbopixel / phpdo-database example snippets


PHPDO::connect("database-server.com", "database_name", "user_name", "myPassword123");

PHPDO::get()->query("SELECT stars FROM github")->fetchAll();

\PHPDO\PHPDO::connect("database-server.com", "database_name", "user_name", "myPassword123");

// $pdoObject = new PDO();

PHPDO::setPdo($pdoObject);

\PHPDO\PHPDO::get()

\PHPDO\PHPDO::get()->query("SELECT * FROM github")->fetchAll();

\PHPDO\PHPDO::get()->getPdo()

\PHPDO\PHPDO::get()->query("SELECT id FROM user WHERE active = 1");
print_r( $pdoStmnt->fetch() );

\PHPDO\PHPDO::get()->execute("UPDATE user SET active = 0 WHERE mail IS NULL");

\PHPDO\PHPDO::get()->prepare("UPDATE github SET stars = stars+1 WHERE id = :id", ["id" => 1234]);

\PHPDO\PHPDO::get()->fetch("SELECT id FROM github WHERE id = :repo", ["repo" => 553]);

$rows  = [];
$stmnt = \PHPDO\PHPDO::get()->prepare("SELECT * FROM github WHERE id = ?", [
  1234
]);

if($stmnt instanceof PDOStatement){
  $rows = $stmnt->fetchAll();
}else{
 die("QUERY ERROR");
}

print_r($rows);

\PHPDO\PHPDO::get()->fetchAll("SELECT id FROM github WHERE id = :repo", ["repo" => 553]);

\PHPDO\PHPDO::get()->rowCount("SELECT id FROM github WHERE id = :repo", ["repo" => 553]);

\PHPDO\PHPDO::get()->isTable("user_settings")

\PHPDO\PHPDO::get()->findPrimaryIndexColumn("tablename", "databasename")

\PHPDO\PHPDO::$logging = true;

\PHPDO\PHPDO::get()->getLog(); // returns an array