Skip to content

Commit

Permalink
Updating docs, fixes bug #163
Browse files Browse the repository at this point in the history
  • Loading branch information
kwhat committed Dec 24, 2021
1 parent e5af951 commit 18a5428
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
4 changes: 3 additions & 1 deletion docs/Statement/Delete.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ $database = new Database('mysql:host=localhost;dbname=test_db;charset=UTF8');
// DELETE FROM users
$delete = new Delete($database, 'users');

$affectedRows = $delete->execute()->rowCount();
if (($result = $delete->execute()) !== false) {
$affectedRows = $result->rowCount();
}
```

## Methods
Expand Down
14 changes: 9 additions & 5 deletions docs/Statement/Insert.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ $insert = new Insert($database, ['id', 'username', 'password']);
$insert->into('users')
->values(1234, 'user', 'passwd');

$insertId = $insert->execute()
->lastInsertId();
if ($insert->execute()) {
$insertId = $database->lastInsertId();
}
```

## Methods
Expand Down Expand Up @@ -82,9 +83,12 @@ use FaaPz\PDO\Statement\Insert;
$database = new Database('mysql:host=localhost;dbname=test_db;charset=UTF8');

// INSERT INTO users (id, username, password) VALUES (? , ? , ?), (? , ? , ?)
$database->insert()
->into('users')
->columns(['id', 'username', 'password'])
$insert = new Insert($database, ['id', 'username', 'password']);
$insert->into('users')
->values([1, 'user1', 'passwd1'])
->values([2, 'user2', 'passwd2']);

if (($result = $delete->execute()) !== false) {
$affectedRows = $result->rowCount();
}
```
4 changes: 3 additions & 1 deletion docs/Statement/Update.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ $update = new Update($database, [
'password'
]);

$insertId = $insert->execute()->lastInsertId();
if (($result = $insert->execute()) !== false) {
$affectedRows = $result->rowCount();
}
```

## Methods
Expand Down

0 comments on commit 18a5428

Please sign in to comment.