1. Go to this page and download the library: Download tnapf/pdo 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/ */
$driver = Driver::createMySqlDriver("root", "password", "database")->connect();
$driver = Driver::createPostgresSqlDriver("root", "password", "database")->connect();
$driver = Driver::createSQLiteDriver("/path/to/db.sqlite")->connect();
// you can set the host and port in the last two parameters but they default to localhost and the default port of the service
$rows = $driver->query("SELECT * FROM table")->fetchAll(PDO::FETCH_ASSOC);
$driver->prepare("SELECT * FROM table WHERE column = :column");
$driver->bindValue("column", "value");
$driver->execute();
$rows = $driver->fetchAll(PDO::FETCH_ASSOC);
(new Driver(true))
->withUsername("root")
->withPassword("password")
->withDatabase("database")
->withHost("127.0.0.1")
->connect()
;
function getRowWhereIdIs(int $id, int $fetch_type = PDO::FETCH_ASSOC): mixed
{
Driver::prepare("SELECT * FROM table WHERE id = :id");
Driver::bindValue("id", $id);
Driver::execute();
return Driver::fetch($fetch_type);
}
$row = getRowWhereIdIs(20);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.