1. Go to this page and download the library: Download baddum/sql418 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/ */
baddum / sql418 example snippets
$request = new Baddum\SQL418\Request('SELECT * from table');
echo $request->extend('WHERE id = 39');
// SELECT * FROM table WHERE id = 39;
echo $request->extend('SELECT name');
// SELECT name FROM table WHERE id = 39;
echo $request->extend('SELECT &, id');
// SELECT name, id FROM table WHERE id = 39;
echo $request->extend('DELETE');
// DELETE FROM table WHERE id = 39;
$sql->extend('UPDATE SET name = "Albert" WHERE & AND right <> admin"');
echo $sql;
// UPDATE table SET name = "Albert" WHERE id = 39 AND right <> admin;
class UserModel {
protected $SQLFetchById = 'SELECT * from user WHERE user.id=?';
protected $SQLDeleteById = '';
public function __construct() {
$request = new Request($this->SQLFetchById);
$this->SQLDeleteById = $request->extend('DELETE');
}
}
class UserModelSoftDelete extends UserModel {
public function __construct() {
$request = new Request($this->SQLFetchById);
$this->SQLFetchById = $request->extend('WHERE & AND user.deleted = 0');
$this->SQLDeleteById = $request->extend('UPDATE & SET user.deleted = 1');
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.