# Changing Table Data

## delete(*$table*, *$criteria*)

Create DELETE statement and add to queue. Criteria specified in *$criteria* can be a CriteriaElement object, or a string to use as the where clause.

Returns *true* on success, or *false* on error. Additional information may be available using getLastError() and getLastErrNo().

## insert(*$table*, *$columns*, *$quoteValue*)

Adds an INSERT SQL statement for the table named *$table* to the work queue. The data to insert is supplied in *$columns* as an array. Each element in the array is in the form `array('column' => 'value')`.

By default, the value portion of the supplied *$columns* entries is quoted in the resulting SQL. To supply your own quoting, supply *false* for *$quoteValue*. This is especially useful if you are using expressions in the values.

Returns *true* on success, or *false* on error. Additional information may be available using getLastError() and getLastErrNo().

## update(*$table*, *$columns*, *$criteria*, *$quoteValue*)

Adds an UPDATE SQL statement for the table named *$table* to the work queue. The data to updated is supplied in *$columns* as an array. Each element in the array is in the form `array('column' => 'value')`. Criteria specified in *$criteria* to limit which rows are updated can be a CriteriaElement object, or a string to use as the where clause.

By default, the value portion of the supplied *$columns* entries is quoted in the resulting SQL. To supply your own quoting, supply *false* for *$quoteValue*. This is especially useful if you are using expressions in the values.

Returns *true* on success, or *false* on error. Additional information may be available using getLastError() and getLastErrNo().

## truncate(*$table*)

Add statement to empty the table named *$table* to the work queue.

Returns *true* on success, or *false* on error. Additional information may be available using getLastError() and getLastErrNo().


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://xoops.gitbook.io/xmf-cookbook/reference/database/tables/changing-table-data.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
