Skip to content

Commit

Permalink
begin work on #108 docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul M. Jones committed Mar 20, 2017
1 parent c0876e1 commit 8ab9f25
Show file tree
Hide file tree
Showing 11 changed files with 711 additions and 580 deletions.
38 changes: 38 additions & 0 deletions docs/delete.md
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());
?>
```
Loading

0 comments on commit 8ab9f25

Please sign in to comment.