Function __global->get_db_for
Definitions
sources/database.php
- Find the correct database connection for a particular table. i.e. site connection or forum connection.This only works with site/Conversr tables, not third-party forums.If modifying this function, search for other cases in the code for 'f_welcome_emails', as similar logic is used elsewhere.Also see: is_forum_db, is_on_multi_site_network.
- Visibility: public
- Is abstract?: No
- Is static?: No
- Is final?: No
- Returns: object
Parameters
| Name | Type | Passed by reference? | Variadic? | Default | Set | Range | Description |
|---|---|---|---|---|---|---|---|
| $table | ID_TEXT | No | No | required parameter | N/A | N/A | Database table |
| $force_site_db | boolean | No | No | False | N/A | N/A | Whether to force use of the site connection |
Returns
- Database connection
- Type: object
- Set: N/A
- Range: N/A
Preview
Code (PHP)
/**
* Find the correct database connection for a particular table. i.e. site connection or forum connection.This only works with site/Conversr tables, not third-party forums.If modifying this function, search for other cases in the code for 'f_welcome_emails', as similar logic is used elsewhere.Also see: is_forum_db, is_on_multi_site_network.
*
* @param ID_TEXT $table Database table
* @param boolean $force_site_db Whether to force use of the site connection
* @return object Database connection
*/
function get_db_for(string $table, bool $force_site_db = false) : object
* Find the correct database connection for a particular table. i.e. site connection or forum connection.This only works with site/Conversr tables, not third-party forums.If modifying this function, search for other cases in the code for 'f_welcome_emails', as similar logic is used elsewhere.Also see: is_forum_db, is_on_multi_site_network.
*
* @param ID_TEXT $table Database table
* @param boolean $force_site_db Whether to force use of the site connection
* @return object Database connection
*/
function get_db_for(string $table, bool $force_site_db = false) : object

