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");
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.