Function DatabaseConnector->__construct

Definitions

sources/database.php

  • Construct a database driver from connection parameters.
  • Visibility: public
  • Is abstract?: No
  • Is static?: No
  • Is final?: No

Parameters

Name Type Passed by reference? Variadic? Default Set Range Description
$db_name string No No required parameter N/A N/A The database name
$db_host string No No required parameter N/A N/A The database server
$db_user string No No required parameter N/A N/A The connection username
$db_password string No No required parameter N/A N/A The connection password
$table_prefix string No No required parameter N/A N/A The table prefix
$fail_ok boolean No No False N/A N/A Whether to on error echo an error and return with a null, rather than giving a critical error
$static ?object No No Null N/A N/A Static call object (null: use global static call object)

Preview

Code (PHP)

/**
 * Construct a database driver from connection parameters.
 *
 * @param  string $db_name The database name
 * @param  string $db_host The database server
 * @param  string $db_user The connection username
 * @param  string $db_password The connection password
 * @param  string $table_prefix The table prefix
 * @param  boolean $fail_ok Whether to on error echo an error and return with a null, rather than giving a critical error
 * @param  ?object $static Static call object (null: use global static call object)
 */

public function __construct(string $db_name, string $db_host, string $db_user, string $db_password, string $table_prefix, bool $fail_ok = false, ?object $static = null)