1. Go to this page and download the library: Download jpi/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/ */
jpi / database example snippets
$connection = new \JPI\Database(
"mysql:host=localhost;dbname=your_database",
"username",
"password"
);
// Prepare a statement with bound parameters (without executing)
$statement = $connection->prep(
"SELECT * FROM users WHERE email = :email;",
["email" => "[email protected]"]
);
// You can now execute it later
$statement->execute();
// Prepare and execute a query in one step
$statement = $connection->run(
"SELECT * FROM users WHERE email = :email;",
["email" => "[email protected]"]
);
// Fetch results from the statement
$rows = $statement->fetchAll(PDO::FETCH_ASSOC);