> For the complete documentation index, see [llms.txt](https://playground.e107sk.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://playground.e107sk.com/e107-efiction-integration-update/outdated/db-functions.md).

# DB functions

{% hint style="warning" %}
Important change:  return value 0 means that nothing was changed. It is not an error. With update() it returns the number of changed records, with insert() inserted ID.&#x20;
{% endhint %}

| Original function                    | Replacement                                    |
| ------------------------------------ | ---------------------------------------------- |
| `dbquery("UPDATE...")`               | `e107::getDb()->gen("UPDATE...")`              |
| `dbquery("INSERT INTO...")`          | `e107::getDb()->gen("INSERT INTO...")`         |
| `dbquery("SELECT... + LIMIT 1)  (*)` | `e107::getDb()->retrieve("SELECT ... LIMIT 1)` |
|                                      |                                                |

`(*)` Example :&#x20;

```
$pagequery = dbquery("SELECT... + LIMIT 1); 
$result = dbassoc($pagequery);
$field = $result['field'];
```

&#x20;Replace with:

```
$result = e107::getDb()->retrieve("SELECT... + LIMIT 1); 
$field = $result['field'];
```
