1. Go to this page and download the library: Download yetidevworks/yetisql 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/ */
yetidevworks / yetisql example snippets
use YetiDevWorks\YetiSQL\PDO;
$db = new PDO('yetisql:app.ysql'); // or 'yetisql::memory:'
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$db->exec('CREATE TABLE users (
id INTEGER PRIMARY KEY AUTOINCREMENT,
name TEXT NOT NULL,
email TEXT UNIQUE COLLATE NOCASE,
age INTEGER
)');
$stmt = $db->prepare('INSERT INTO users (name, email, age) VALUES (?, ?, ?)');
$stmt->execute(['Alice', '[email protected]', 30]);
$stmt->execute(['Bob', '[email protected]', 25]);
$rows = $db->query('SELECT name, age FROM users WHERE age >= 18 ORDER BY age DESC')
->fetchAll(PDO::FETCH_ASSOC);
echo $db->lastInsertId();