-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Paul M. Jones
committed
Mar 20, 2017
1 parent
c0876e1
commit 8ab9f25
Showing
11 changed files
with
711 additions
and
580 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# DELETE | ||
|
||
Build a _Delete_ query using the following methods. They do not need to | ||
be called in any particular order, and may be called multiple times. | ||
|
||
```php | ||
<?php | ||
$delete = $queryFactory->newDelete(); | ||
|
||
$delete | ||
->from('foo') // FROM this table | ||
->where('zim = :zim') // AND WHERE these conditions | ||
->where('gir = ?', 'doom') // bind this value to the condition | ||
->orWhere('gir = :gir') // OR WHERE these conditions | ||
->bindValue('bar', 'bar_val') // bind one value to a placeholder | ||
->bindValues([ // bind these values to the query | ||
'baz' => 99, | ||
'zim' => 'dib', | ||
'gir' => 'doom', | ||
]); | ||
?> | ||
``` | ||
|
||
Once you have built the query, pass it to the database connection of your | ||
choice as a string, and send the bound values along with it. | ||
|
||
```php | ||
<?php | ||
// the PDO connection | ||
$pdo = new PDO(...); | ||
|
||
// prepare the statement | ||
$sth = $pdo->prepare($delete->getStatement()) | ||
|
||
// execute with bound values | ||
$sth->execute($delete->getBindValues()); | ||
?> | ||
``` |
Oops, something went wrong.