Created
November 23, 2016 00:01
-
-
Save wilcorrea/95c66f9c0d2be20c0c502907db30af80 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| require dirname(__DIR__) . '/vendor/autoload.php'; | |
| /** @noinspection PhpIncludeInspection */ | |
| $options = include dirname(__DIR__) . '/config/database.php'; | |
| $qb = new Hero\QueryBuilder($options); | |
| #INSERT | |
| $qb | |
| ->table('users') | |
| ->fields(['nome', 'login', 'password']) | |
| ->insert(['William', 'wilcorrea', crypt('senha')]); | |
| #SELECT | |
| $qb | |
| ->table('users') // poderia não informar, pois já está "salvo" | |
| ->fields(['id', 'nome', 'login', 'password']) | |
| ->select(); | |
| # UPDATE | |
| $qb | |
| ->table('users') // poderia não informar, pois já está "salvo" | |
| ->fields(['nome']) | |
| ->where(['id = ?']) | |
| ->update(['William Correa'], [2]); | |
| #DELETE | |
| $qb | |
| ->table('users') // poderia não informar, pois já está "salvo" | |
| ->where(['id = ?']) | |
| ->delete([1]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment