Topic: What does Table Pref refer to in Company Setup?

I searched the forum and wiki and cannot find a reference to this. It seems to increment a number (_3 or _6) when you add a company, yet I had some functions appear not to work if I let the incrementation occur. If I leave it as blank, then all functions appear to work.

Any suggestions?

Re: What does Table Pref refer to in Company Setup?

Many webhosts only allow clients to have one MySql database. By using table prefixes, you can have multiple companies inside one database. The first company gets 0_ in front of all the tables, the next company gets 1_ and so on.
You don't need to use this feature, if you can create an unlimited amount of databases. However many like to have all their companies inside one database.

/Joe

3 (edited by scendraw 06/24/2020 05:29:58 am)

Re: What does Table Pref refer to in Company Setup?

I deleted a company with table pref 3_  then I went on to create another company but I cannot choose 3_ it has to be 4_.

Is this normal?

Re: What does Table Pref refer to in Company Setup?

@scendraw of course database field are Auto-incremental, especially if the field is a primary key. It doesn't matter whether you delete a record or not, the space is already taken, the next record will be auto-increment. So what you can do is update the structure of your table.

Syntax:
ALTER TABLE table_name AUTO_INCREMENT = start_value;

For Example:

ALTER TABLE Company AUTO_INCREMENT = 50;

Hope this help

Re: What does Table Pref refer to in Company Setup?

The counter value is in the file config_db.php where the variable $tb_pref_counter should refer to the next available array element.

The command to set the auto increment field correctly (self-adjusting) at the end would be:

ALTER TABLE <table_name> AUTO_INCREMENT = 1;

but in FA, there is no "Company" table.