Oracle 5.0 Reference Manual page 2266

Table of Contents

Advertisement

link_identifier
Return Values
Returns
TRUE
Examples
Example 20.26.
<?php
$link = mysql_connect('localhost', 'mysql_user', 'mysql_password');
if (!$link) {
die('Could not connect: ' . mysql_error());
}
echo 'Connected successfully';
mysql_close($link);
?>
The above example will output:
Connected successfully
Notes
See Also
mysql_connect
mysql_free_result
20.7.2.5.4.
mysql_connect
Copyright 1997-2012 the PHP Documentation Group. [2230]
mysql_connect
Open a connection to a MySQL Server
Description
resource mysql_connect(
string server
=
string username
Original MySQL API (Mysql)
on success or
FALSE
example
mysql_close
Note
mysql_close
Warning
This extension is deprecated as of PHP 5.5.0, and will be removed in the
future. Instead, the
also
MySQL: choosing an API
Alternatives to this function include:
mysqli_connect
PDO::__construct
=ini_get("mysql.default_host"),
The MySQL connection. If the link identifier is not specified, the last
link opened by
mysql_connect
found or established, an
on failure.
will not close persistent links created by mysql_pconnect.
MySQLi
or
PDO_MySQL
guide and
2246
is assumed. If no connection is
level error is generated.
E_WARNING
extension should be used. See
related FAQ
for more information.

Advertisement

Table of Contents
loading

This manual is also suitable for:

Mysql 5.0

Table of Contents