PHP3 Manual
PrevNext

mysql_connect

mysql_connect -- open MySQL server connection

Description

int mysql_connect(string hostname , string username , string password );

Returns: A positive MySQL link identifier on success, or false on error.

mysql_connect() establishes a connection to a MySQL server. All of the arguments are optional, and if they're missing, defaults are assumed ('localhost', user name of the user that owns the server process, empty password). The hostname string can also include a port number. eg. "hostname:port"

In case a second call is made to mysql_connect() with the same arguments, no new link will be established, but instead, the link identifier of the already opened link will be returned.

The link to the server will be closed as soon as the execution of the script ends, unless it's closed earlier by explicitly calling mysql_close().

See also mysql_pconnect(), and mysql_close().


PrevHomeNext
mysql_closeUpmysql_create_db