mini\Database\PartialQuery::insert()
Method
public
Signature
public function insert(array $row): string|int
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$row |
array |
required | Documentation missing |
Returns
string|int
Documentation
Insert a new row into the underlying table
The row must match ALL query constraints (WHERE clause conditions). This ensures you can only insert rows that would be visible in this query.
$users = db()->query('SELECT * FROM users WHERE org_id = ?', [5]);
$users->insert(['org_id' => 5, 'name' => 'John']); // OK
$users->insert(['org_id' => 6, 'name' => 'Jane']); // Throws - wrong org_id