Commit b712ebc
authored
after_create
Hi Maurits,
I needed a callback function that got triggered on a new db entry (Create).
For example I wanted to send an e-mail to a newly registered member.
In this example I have a "members" table with the columns: id , firstName, lastName, email
the yourEmailFunction method will send a welcome message to the newly entered member.
```php
$api = new PHP_CRUD_API(array(
'after_create'=>function($db,$tab,$row) {
if ($tab == 'members')
yourEmailFunction($row['firstName'],$row['lastName'],$row['email']);
}
}
));
$api->executeCommand();
```
Tell me you thoughts... maybe if you like it and willing to accept the pull request I can also create an after_delete and after_update method.1 parent 88b7bdb commit b712ebc
1 file changed
+18
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1134 | 1134 | | |
1135 | 1135 | | |
1136 | 1136 | | |
| 1137 | + | |
| 1138 | + | |
| 1139 | + | |
| 1140 | + | |
| 1141 | + | |
| 1142 | + | |
| 1143 | + | |
| 1144 | + | |
| 1145 | + | |
| 1146 | + | |
| 1147 | + | |
| 1148 | + | |
1137 | 1149 | | |
1138 | 1150 | | |
1139 | 1151 | | |
| |||
1467 | 1479 | | |
1468 | 1480 | | |
1469 | 1481 | | |
1470 | | - | |
| 1482 | + | |
| 1483 | + | |
| 1484 | + | |
| 1485 | + | |
1471 | 1486 | | |
1472 | 1487 | | |
1473 | 1488 | | |
| |||
2109 | 2124 | | |
2110 | 2125 | | |
2111 | 2126 | | |
| 2127 | + | |
2112 | 2128 | | |
2113 | 2129 | | |
2114 | 2130 | | |
| |||
2160 | 2176 | | |
2161 | 2177 | | |
2162 | 2178 | | |
2163 | | - | |
| 2179 | + | |
2164 | 2180 | | |
2165 | 2181 | | |
2166 | 2182 | | |
| |||
0 commit comments