1. Go to this page and download the library: Download celtak/dog-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/ */
// Insert new data
$database->insert([
['first', 'Henrique'],
['name', 'Rodrigues'],
['old', 33],
]);
$read = $database->getAll();
// All the contents of the database
dump($read);
$read = $database->getAll([
'where' => ['name', 'Rodrigues'],
'orderBy' => 'old',
]);
// Just "Melanie Rodrigues" and "Henrique Rodrigues"
dump($read);
$read = $database->getAll([
'limit' => [1, 3]
]);
// Just "Melanie Rodrigues", "Anthony Jones" and "Audrey Jones"
dump($read);
$read = $database->getFields(['name', 'first']);
// We just get the "name" and "first" fields of only "Anthony Jones" and "Audrey Jones"
dump($read);
$read = $database->getFields(['name', 'first'], [
'where' => ['name', 'Jones']
]);
// We just get the "name" and "first" fields from all the database
dump($read);
$read = $database->getId(3);
// We get the data related to id 3, "Audrey Jones"
dump($read);
// Modify the first name Henrique by Rik
$database->update(
[
['first', 'Rik']
],
[
'where' => ['first', 'Henrique'],
]
);
// Modify the first name by John and the name by Taylor from id 3
$database->updateId(3,
[
['first', 'John'],
['name', 'Taylor'],
]);
// Delete all data from id 2
$database->delete([
'where' => ['id', '2']
]);
// Delete all data from id 1
$database->deleteId(1);
dump($database->getCustomizedQuery('SELECT * FROM users WHERE id = "10"'));
$database->customizedExec('INSERT INTO utilisateurs (name, first, old) VALUES ("Henrique", "Rodrigues", "33")');
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.