Mysql_connect
(PHP3, PHP4)
Mysql_connect---&http://www.aliyun.com/zixun/aggregation/37954.html ">nbsp; Open MySQL server connection
Syntax: int mysql_connect ([string hostname [:p ort] [:/path/to/socket] [, String username [, string password]])
Description:
Success returns a positive number of MySQL link identifier, failure returns the error message.
Mysql_connect () set up MySQL server link, all parameters are not required, if you do not give the parameter value, the default is assumed to be (' localhost ', with the server processing user name, no password).
Hostname can also include port numbers, such as "hostname:port" or the socket path, for example: ":/path/to/socket"
Note: ":p ort" is added to the PHP3.0B4, PHP3.0.10 provides ":/path/to/socket", and you can use ' @ ' (@mysql_connect ()) to suppress the message returned when the error occurs.
If the second call to Mysql_connect () with the same parameters, no new link will be established, but will be returned to the previously opened knot identifier to replace.
When the program is finished, the connection to the server is immediately closed unless the mysql_close () is called earlier to close.
Example:
<?php
$link = mysql_connect ("Kraemer", "Marliesle", "secret") or Die ("could not Connect");
Print ("Connected successfully");
Mysql_close ($link);
?>
Reference: Mysql_pconnect () mysql_close ()