Database Tables

Depending on what your module does, the information on this page may not be necessary. But if you find you need to store data in the database, Form Tools provides a number of built-in functions to make your job just that little bit easier.

Storing small amounts of data - settings

If you only need to store small information snippets - like settings, you may be able to get away without adding your own tables. Form Tools comes with a couple of handy functions that store data permanently in the main ft_settings table. Give these functions a read through for more information on how they can help.

Creating your own database tables

Module database tables should all follow this naming convention (N.B. the ft_ prefix in these examples actually depends on the users installation, so be sure to always use the $g_table_prefix global variable when constructing table names):

ft_module_[module folder name]_[table name]

So if our "My Module" module needed its own custom data table, the database table would be something like:

ft_module_my_module_data

Custom database tables can be created at any point, depending on your needs. Generally they're created by your installation function and deleted by your uninstallation function - but this is by no means enforced. If need be, you can create your tables within your module pages, based on user input.

Edit Page