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.
Mysql_pconnect () is very similar to mysql_connect (), and there are two major differences between them.
First, when the link time function will first try to find the same host, the user name, the password of the previously opened link, if found, then this identifier will be returned to replace the opening of a new link.
Second, when the program is finished, it will not close the connection to the MySQL server, but will be retained for later use. (Mysql_close () will not be able to close the link opened with Mysql_pconnect ())
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.