ADOdb

Database Abstraction Layer for PHP

User Tools

Site Tools


v5:reference:connection:connect

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
v5:reference:connection:connect [2022/02/12 18:14] – [Description] use of setConnectionParameter() dregadv5:reference:connection:connect [2023/05/07 10:37] (current) – Better return value description (boolean, not mixed) dregad
Line 5: Line 5:
 [[v5:database:connection_matrix|The Connection Matrix]] [[v5:database:connection_matrix|The Connection Matrix]]
 == Syntax == == Syntax ==
-   mixed connect(+   bool connect(
          optional string $parameter1 = '',          optional string $parameter1 = '',
          optional string $parameter2 = '',          optional string $parameter2 = '',
Line 21: Line 21:
  
 The traditional description of the connection parameters is as follows: The traditional description of the connection parameters is as follows:
--------------------------------------+
 ^ Parameter 1  ^ Parameter 2  ^ Parameter 3  ^ Parameter 4  ^ ^ Parameter 1  ^ Parameter 2  ^ Parameter 3  ^ Parameter 4  ^
 |  $hostName    $userId      $password    $database   | |  $hostName    $userId      $password    $database   |
Line 27: Line 27:
 However the actual values of the parameters for some databases are such that the actual requirements can be confusing. See the [[v5:database:connection_matrix|Connection Matrix]] for assistance. However the actual values of the parameters for some databases are such that the actual requirements can be confusing. See the [[v5:database:connection_matrix|Connection Matrix]] for assistance.
  
-If the connection is made, $db becomes a database connection object that can be used until the script ends. If the connection failsthe value is set to false.+If the connection is made, $db becomes a database connection object that can be used until the script ends.  
 + 
 +=== Return value === 
 + 
 +The method returns //true// if the connection was successfully established//false// otherwise. This should be checked before continuing with code execution.
  
 To debug the connection, set the value '' $db->debug = true; '' before calling the '' $db->connect '' statement To debug the connection, set the value '' $db->debug = true; '' before calling the '' $db->connect '' statement
v5/reference/connection/connect.txt · Last modified: 2023/05/07 10:37 by dregad